コード例 #1
0
        public override GameCommandStatus FixedStep()
        {
            if (finalTick == -1)
            {
                if (_iBuff.Validate(_buffData))                     //if it is valid then the effect will be applied
                {
                    _iBuff.Apply(_buffData);
                    Debug.Log("applied armor buff");                      //actually working but why so infrequently
                }
                else
                {
                    return(GameCommandStatus.Complete);                    //don't do the buff
                }
                finalTick = _tick.currentTick + _buffData.duration;
            }
            else
            {
                if (_tick.currentTick > finalTick)
                {
                    _iBuff.Clear(_buffData);
                    return(GameCommandStatus.Complete);
                }
            }
            return(GameCommandStatus.InProgress);            //if it has not passed the final tick then keep the buff going.


            //_unitReceiver.UnitData.hpAdded = _unitReceiver.UnitData.hpAdded + _hpAddedValue;
            //Debug.Log("received buff");

            //Logs this buff in the event list. Maybe this could be done in the command processor itself?
            //EventObj newEvent = new EventObj(Time.time, 2, currentBuffObj.buffType, currentBuffObj.buffSender, currentBuffObj.buffDuration, currentBuffObj.buffStrength);
            //_receivingUnit.UnitData.eventList.Add(newEvent);

            //first time it is called, when it is first called take the current tick and figure out the final tick: wait and send in progress, check the current tick. After
            //the current tick == more than the finaltick call clear and return complete.

            //multiple conditions for the buff clearing: one of the conditions is the tick = final tick. Is this unit still alive: clear.
        }