Esempio n. 1
0
 public void SetBuff(UnitBuffType buffType)
 {
     if (localBuff == UnitBuffType.NONE)
     {
         this.localBuff = buffType;
     }
 }
Esempio n. 2
0
        static Text TextForBuffType(UnitView view, UnitBuffType type)
        {
            switch (type)
            {
            case UnitBuffType.Attack: return(view.attack);

            case UnitBuffType.Defence: return(view.defence);

            case UnitBuffType.Hp: return(view.hp);

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
        }
Esempio n. 3
0
        static Cell <int> StatForBuffType(Unit unit, UnitBuffType type)
        {
            switch (type)
            {
            case UnitBuffType.Attack: return(unit.attack);

            case UnitBuffType.Defence: return(unit.defence);

            case UnitBuffType.Hp: return(unit.hp);

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
        }
Esempio n. 4
0
    public static Color GetColorByBuffType(UnitBuffType t)
    {
        switch (t)
        {
        case UnitBuffType.INCREASE_FACTORY:
            return(GetColorByType(UnitType.Mine));

        case UnitBuffType.INCREASE_GRASS:
            return(GetColorByType(UnitType.Grass));

        default:
            return(Color.white);
        }
    }
Esempio n. 5
0
        static ICell <int> FinalStat(Unit unit, Equipment eq, UnitBuffType buffType)
        {
            // selected unit can be null.
            if (unit == null)
            {
                return(StaticCell <int> .Default());
            }

            var stat = StatForBuffType(unit, buffType);

            // If equipment does not buff this stat return just stat.
            if (eq == null || eq.type != buffType)
            {
                return(stat);
            }
            // If equipment stat match this kind of stat merge those.
            return(stat.Merge(eq.buff, (s, buff) => s + buff));
        }