Exemplo n.º 1
0
        /// <summary>Activate the State </summary>
        public virtual void Activate()
        {
            var LastState = animal.LastState;

            if (LastState != null && QueueFrom.Contains(LastState.ID) && !OnQueue)
            {
                if (animal.debugStates)
                {
                    Debug.Log(ID.name + " State has being queued");
                }
                animal.QueueState(this);
                OnQueue = true;
                animal.ActiveState.AllowExit();
                animal.LastState = this;
            }

            if (OnQueue)
            {
                return;
            }

            animal.LastState = animal.ActiveState;                          //Set a new Last State

            LastStateExit();

            SetSpeeds();
            LastStatePendingExit = false;

            if (animal.debugStates)
            {
                Debug.Log("Activate: <B>" + ID.name + "</B> State");
            }

            animal.JustActivateState = true;

            animal.ActiveState = this;          //Update to the Current State
            IsActiveState      = true;          //Set this state as the Active State
            IsPending          = true;          //We need to set is as pending since we have not enter this states animations yet IMPORTANT

            EnterExitEvent?.OnEnter?.Invoke();
        }
Exemplo n.º 2
0
        /// <summary>Activate the State </summary>
        public virtual void Activate()
        {
            SetSpeeds();

            animal.LastState = animal.ActiveState;                          //Set a new Last State
            var LastState = animal.LastState;

            if (LastState != null && QueueFrom.Contains(LastState.ID) && !OnQueue)
            {
                if (animal.debugStates)
                {
                    Debug.Log(ID.name + " State has being Queue");
                }
                OnQueue = true;
                animal.QueueState(this);
            }

            if (OnQueue)
            {
                return;
            }

            if (animal.debugStates)
            {
                Debug.Log("Activate: <B>" + ID.name + "</B> State");
            }

            LastStateExit();

            animal.JustActivateState = true;

            animal.ActiveState = this;          //Update to the Current State
            ActiveState        = true;          //Set this state as the Active State
            IsPending          = true;          //We need to set is as pending since we have not enter this states animations yet IMPORTANT

            //    Debug.Log("<b>"+name+"</b>");

            if (EnterExitEvent != null)
            {
                EnterExitEvent.OnEnter.Invoke();
            }
        }
Exemplo n.º 3
0
        /// <summary>Activate the State </summary>
        public virtual void Activate()
        {
            SetSpeeds();

            animal.LastState = animal.ActiveState;                          //Set a new Last State
            var LastState = animal.LastState;

            if (LastState != null && QueueFrom.Contains(LastState.ID) && !OnQueue)
            {
                if (animal.debugStates)
                {
                    Debug.Log(ID.name + " State has being Queue");
                }
                OnQueue = true;
                animal.QueueState(this);
            }

            if (OnQueue)
            {
                return;
            }

            if (animal.debugStates)
            {
                Debug.Log("Enter State: " + ID.name);
            }

            LastStateExit();

            animal.JustActivateState = true;

            animal.ActiveState = this;                                      //Update to the Current State
            ActiveState        = true;

            if (EnterExitEvent != null)
            {
                EnterExitEvent.OnEnter.Invoke();
            }
        }