Ejemplo n.º 1
0
        protected void TryActivateState()
        {
            if (ActiveState.IsPersistent)
            {
                return;                           //If the State cannot be interrupted the ingored trying activating any other States
            }
            if (ActiveState.IsPending)
            {
                return;                           //Do not try to activate any other state if  The Active State is Pending
            }
            foreach (var state in states)
            {
                if (state.IsActiveState)
                {
                    if (state.IsPending)
                    {
                        return;                             //Do not try to activate any other state if  The Active State is Pending
                    }
                    if (state.IgnoreLowerStates)
                    {
                        return;                             //If the Active State cannot exit ignore lower priority States
                    }
                    continue;                               //Ignore Try Activating yourSelf
                }


                if (StateQueued != null && state.ID == StateQueued.ID)
                {
                    continue;                                                       //if the State on the list is on Queue Continue
                }
                if (state.Active && !state.IsSleepFromState && !state.IsSleepFromMode && state.TryActivate())
                {
                    // if (state.StateAnimationTags(AnimStateTag)) return;          //The Last State has not already exit the Animation State so do not Activate it

                    if (StateQueued != null && !StateQueued.QueueFrom.Contains(state.ID))
                    {
                        StateQueued.ActivateQueued();
                        StateQueued = null;
                        break;
                    }

                    state.Activate();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        protected void TryActivateState()
        {
            if (ActiveState.IsPersistent)
            {
                return;                           //If the State cannot be interrupted the ingored trying activating any other States
            }
            if (ActiveState.IsPending)
            {
                return;                           //Do not try to activate any other state if  The Active State is Pending
            }
            foreach (var state in states)
            {
                if (state.IsActiveState)
                {
                    if (state.IsPending)
                    {
                        return;                             //Do not try to activate any other state if  The Active State is Pending
                    }
                    if (state.IgnoreLowerStates)
                    {
                        return;                             //If the Active State cannot exit ignore lower priority States
                    }
                    continue;                               //Ignore Try Activating yourSelf
                }

                if (StateQueued != null && state.ID == StateQueued.ID)
                {
                    continue;                                                                                 //if the State on the list is on Queue Continue
                }
                if (state.Active && !state.IsSleepFromState && !state.IsSleepFromMode && state.TryActivate()) //Means a new state can be activated
                {
                    if (StateQueued != null && !StateQueued.QueueFrom.Contains(state.ID))                     // Lets Try activate the OldState
                    {
                        StateQueued.ActivateQueued();
                        break;
                    }
                    state.Activate();
                    break;
                }
            }
        }