Apply() public method

public Apply ( ) : void
return void
 override public void FixedUpdate()
 {
     base.FixedUpdate();
     if (paused)
     {
         return;
     }
     if (activeCharacter == null)
     {
         float           highestInit = -1;
         SkillActivation nowSA       = null;
         foreach (SkillActivation sa in pendingSkillActivations)
         {
             if (sa.delay > highestInit)
             {
                 highestInit = sa.delay;
                 nowSA       = sa;
             }
         }
         if (order.Count > 0 && order[0].initiative > highestInit)
         {
             highestInit = order[0].initiative;
             nowSA       = null;
         }
         activeInitiative = highestInit;
         if (order.Count == 0)
         {
             EndRound();
         }
         else
         {
             if (nowSA == null)
             {
                 Initiative i = order[0];
                 order.RemoveAt(0);
                 Activate(i.character);
             }
             else
             {
                 nowSA.Apply();
                 pendingSkillActivations.Remove(nowSA);
             }
         }
     }
 }
示例#2
0
    public override void FixedUpdate()
    {
        base.FixedUpdate();
        if (paused)
        {
            return;
        }
        //if there is no active unit
        if (activeCharacter == null)
        {
            //else, take the first unit or action with CT > 100, if any, and activate it
            for (int i = 0; i < pendingSkillActivations.Count; i++)
            {
                SkillActivation sa = pendingSkillActivations[i];
                if (sa.delayRemaining <= 0)
                {
                    sa.Apply();
                    pendingSkillActivations.RemoveAt(i);
                    //FIXME: need to prevent scheduler from
                    //fixedupdate-ing while skills are animating
                    return;
                }
            }
            foreach (Character c in characters)
            {
                float ct    = c.GetStat(ctStat);
                float maxCT = maxCTStat != null?
                              c.GetStat(maxCTStat, defaultMaxCT) :
                                  defaultMaxCT;

                if (ct >= maxCT)
                {
                    c.SetBaseStat(ctStat, maxCT);
                    Activate(c);
                    return;
                }
            }
            //and tick up CT on everything/body by their effective speed
            foreach (SkillActivation sa in pendingSkillActivations)
            {
                sa.delayRemaining =
                    sa.delayRemaining - sa.skill.GetParam(skillSpeedStat, defaultSkillSpeed);
            }
            foreach (Character c in characters)
            {
                //don't mess with jumpers' speed because speed is used in jump timing
                if (c.HasStatusEffect("jumping"))
                {
                    continue;
                }
                float speed = speedStat != null?
                              c.GetStat(speedStat, defaultSpeed) :
                                  defaultSpeed;

                c.AdjustBaseStat(ctStat, speed);
                foreach (StatusEffect se in c.StatusEffects)
                {
                    se.Tick(se.ticksInLocalTime ? speed : 1);
                }
            }
        }
        //otherwise, do nothing
    }