73 lines
1.6 KiB
C#
73 lines
1.6 KiB
C#
using Manager;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public enum LotteryType
|
|
{
|
|
None,
|
|
Hp,
|
|
Mp,
|
|
Attack,
|
|
UpHp,//Ôö¼Ó»ØÑª
|
|
UpMaxHp,//Ôö¼Ó×î´óѪÁ¿
|
|
UpAttack,//
|
|
|
|
}
|
|
public class UILottery : UIWindow
|
|
{
|
|
//public AvtarInfo avtar;
|
|
public string lotterytype;
|
|
public float lotteryvalue;
|
|
public LotteryType LotteryTypes;
|
|
|
|
public CombaSystem ch;
|
|
|
|
public void OnClickLotteryType(string type)
|
|
{
|
|
|
|
//SoundManager.Instance.PlaySound(SoundDefine.ButtonClick);
|
|
|
|
ch = GameObject.FindWithTag("Player").GetComponentInChildren<CombaSystem>();
|
|
|
|
Debug.Log("Lottery");
|
|
lotterytype = type;
|
|
if (lotterytype=="Hp")
|
|
{
|
|
LotteryTypes = LotteryType.Hp;
|
|
}
|
|
else if (lotterytype=="Mp")
|
|
{
|
|
LotteryTypes = LotteryType.Mp;
|
|
}
|
|
else if (lotterytype=="Attack")
|
|
{
|
|
LotteryTypes = LotteryType.Attack;
|
|
}
|
|
CheckLottery();
|
|
}
|
|
public void OnClickLotteryValue(float value)
|
|
{
|
|
lotteryvalue = value;
|
|
}
|
|
public void CheckLottery()
|
|
{
|
|
switch (LotteryTypes)
|
|
{
|
|
case LotteryType.Hp:
|
|
ch.currentHp += lotteryvalue;
|
|
ch.OnHit?.Invoke(ch.currentHp);
|
|
break;
|
|
case LotteryType.Mp:
|
|
ch.maxHp += lotteryvalue;
|
|
ch.OnHit?.Invoke(ch.currentHp);
|
|
break;
|
|
case LotteryType.Attack:
|
|
ch.attack += lotteryvalue;
|
|
ch.OnHit?.Invoke(ch.currentHp);
|
|
break;
|
|
}
|
|
Destroy(this.gameObject);
|
|
}
|
|
}
|