コード例 #1
0
        public override void Update(Delta delta)
        {
            if (currentStatusEffectIndex >= partyMember.StatusEffects.Count || !partyMember.Alive)
            {
                Finish();
                return;
            }

            bool         statusEffectFinished = false;
            StatusEffect statusEffect         = partyMember.StatusEffects[currentStatusEffectIndex];

            StatusEffects.IInflictable inflictable = statusEffect as StatusEffects.IInflictable;
            if (inflictable != null && (inflictable.Inflictor == null || !inflictable.Inflictor.Alive))
            {
                partyMember.StatusEffects.RemoveAt(currentStatusEffectIndex);
                --currentStatusEffectIndex;
                statusEffectFinished = true;
            }

            if (!statusEffectFinished)
            {
                switch (statusEffectEvent)
                {
                case StatusEffectEvent.BeforeAct:
                    if (statusEffect.BeforeActIsFinished())
                    {
                        statusEffectFinished = true;
                    }
                    else
                    {
                        statusEffect.BeforeActUpdate(thinkAction, delta);
                    }
                    break;

                case StatusEffectEvent.EndTurn:
                    if (statusEffect.EndTurnIsFinished())
                    {
                        statusEffectFinished = true;
                    }
                    else
                    {
                        statusEffect.EndTurnUpdate(partyMember, delta);
                    }
                    break;

                default: break;
                }
            }

            if (statusEffectFinished && partyMember.BattleEntity.AnimationState.Animation.Name == partyMember.GetBattleEntityIdleAnimationName())
            {
                getNextStatusEffect();
            }
        }