Example #1
0
        public baseState UpdateChangeStates(IList <baseState> stateList, baseState currentState, GameObject gameObject, bool displayStates)
        {
            if (currentState != null && currentState.m_ChangeBool)
            {
                foreach (baseState state in stateList)
                {
                    if (currentState.m_ChangeStateName.GetHashCode() == state.m_StateName.GetHashCode())
                    {
                        //some debug love
                        displayStates = false;
                        if (displayStates)
                        {
                            Debug.Log("<color=navy>" + "<b>" + "----------------------------------------------" + "</b></color>");
                            if (gameObject != null)
                            {
                                Debug.Log("<color=blue>" + "<b>" + "UpdateChangeState : " + "</b></color>" + "<color=#660066>" + gameObject.name + "</color>" + " .");
                            }
                            else
                            {
                                Debug.Log("<color=blue>" + "<b>" + "UpdateChangeState : " + "</b></color>" + "<color=#660066>" + "State Editor" + "</color>" + " .");
                            }
                            Debug.Log("<color=teal>" + "<b>" + "current state = " + "</b></color>" + "<color=#b3002d>" + currentState.m_StateName + "</color>" + " .");
                            Debug.Log("<color=teal>" + "<b>" + "change state = " + "</b></color>" + "<color=#b3002d>" + state.m_StateName + "</color>" + " .");
                        }

                        currentState.Exit();
                        currentState.m_ChangeBool = false;
                        state.Enter();

                        return(state);
                    }
                }
            }
            return(null);
        }