Beispiel #1
0
        public void ChangeUnitAttr(UnitBase targetUnit, FighterAttributeType attrType, int chgValue)
        {
            if (targetUnit.IsDead)
            {
                return;
            }
            Debug.Log("技能效果生效 目標:" + targetUnit.ID + " 傷害:" + attrType);
            int preValue = targetUnit.GetAttribute(attrType);

            preValue += chgValue;
            if (attrType == FighterAttributeType.Life && preValue <= 0)
            {
                BattleUnitManager.Instance.OnUnitDead(targetUnit.ID);
            }
            else
            {
                targetUnit.SetAttribute(attrType, preValue);
            }
            mAttrChgListener.Invoke(targetUnit.ID, attrType, preValue);
        }
Beispiel #2
0
 public void SetAttribute(FighterAttributeType attrType, int value)
 {
     mAttributes [(int)attrType] = value;
 }
Beispiel #3
0
 public int GetAttribute(FighterAttributeType attrType)
 {
     return(mAttributes[(int)attrType]);
 }