예제 #1
0
        private IEnumerator Sequence(GameAction action)
        {
            Global.Events.Publish(BEGIN_SEQUENCE_NOTIFICATION, action);

            var validationResult = action.Validate();

            if (validationResult.IsValid == false || _victorySystem.IsGameOver())
            {
                foreach (string reason in validationResult.ValidationErrors)
                {
                    Debug.Log($"    -> Invalidated: {reason}");
                }
                action.Cancel();
            }

            var phase = MainPhase(action.PreparePhase);

            while (phase.MoveNext())
            {
                yield return(null);
            }

            phase = MainPhase(action.PerformPhase);
            while (phase.MoveNext())
            {
                yield return(null);
            }

            phase = MainPhase(action.CancelPhase);
            while (phase.MoveNext())
            {
                yield return(null);
            }

            if (_rootAction == action)
            {
                // TODO: Is this needed?
                phase = EventPhase(DEATH_REAPER_NOTIFICATION, action, true);
                while (phase.MoveNext())
                {
                    yield return(null);
                }
            }

            Global.Events.Publish(END_SEQUENCE_NOTIFICATION, action);
        }
예제 #2
0
    //Contiene las fases en las que se divide la secuencia de la acción y permite cancelarla
    IEnumerator Sequence(GameAction action)
    {
        this.PostNotification(beginSequenceNotification, action);

        if (action.Validate() == false)
        {
            action.Cancel();
        }

        var phase = MainPhase(action.prepare);

        while (phase.MoveNext())
        {
            yield return(null);
        }

        phase = MainPhase(action.perform);
        while (phase.MoveNext())
        {
            yield return(null);
        }

        phase = MainPhase(action.cancel);
        while (phase.MoveNext())
        {
            yield return(null);
        }

        if (rootAction == action)
        {
            phase = EventPhase(deathReaperNotification, action, true);
            while (phase.MoveNext())
            {
                yield return(null);
            }
        }

        this.PostNotification(endSequenceNotification, action);
    }
예제 #3
0
        private IEnumerator Sequence(GameAction action)
        {
            this.PostNotification(OnBeginSequenceNotification, action);

            if (!action.Validate())
            {
                action.Cancel();
            }

            var phase = MainPhase(action.PreparePhase);

            while (phase.MoveNext())
            {
                yield return(null);
            }

            phase = MainPhase(action.PerformPhase);
            while (phase.MoveNext())
            {
                yield return(null);
            }

            phase = MainPhase(action.CancelPhase);
            while (phase.MoveNext())
            {
                yield return(null);
            }

            if (rootAction == action)
            {
                phase = EventPhase(OnDeathReaperNotification, action, true);
                while (phase.MoveNext())
                {
                    yield return(null);
                }
            }

            this.PostNotification(OnEndSequenceNotification, action);
        }