/// <summary> /// Advance the squad captain to the next state /// </summary> /// <param name="_enumState"></param> public void Advance(PSState _enumState) { m_CurrentState.Exit(); m_CurrentEnumState = _enumState; m_CurrentState = dict_States[m_CurrentEnumState]; m_CurrentState.Enter(); }
// Start(): Use this for initialization void Start() { // Variable Initialisation m_Brain = this.GetComponent <PS_Logicaliser>(); mAnimate = new Animate(this.transform); dict_States = new Dictionary <PSState, IPSState>(); dict_States.Add(PSState.Idle, new PS_IdleState(this, m_Brain)); dict_States.Add(PSState.Attack, new PS_AttackState(this)); dict_States.Add(PSState.Defend, new PS_DefendState(this)); dict_States.Add(PSState.Produce, new PS_ProduceState(this)); dict_States.Add(PSState.FindResource, new PS_FindResourceState(this)); dict_States.Add(PSState.Dead, new PS_DeadState(this)); m_CurrentEnumState = PSState.Dead; m_CurrentState = dict_States[m_CurrentEnumState]; m_CurrentState.Enter(); }
// Start(): Use this for initialization void Start() { // Variable Initialisation m_Brain = this.GetComponent<PS_Logicaliser>(); mAnimate = new Animate(this.transform); dict_States = new Dictionary<PSState, IPSState>(); dict_States.Add(PSState.Idle, new PS_IdleState(this, m_Brain)); dict_States.Add(PSState.Attack, new PS_AttackState(this)); dict_States.Add(PSState.Defend, new PS_DefendState(this)); dict_States.Add(PSState.Produce, new PS_ProduceState(this)); dict_States.Add(PSState.FindResource, new PS_FindResourceState(this)); dict_States.Add(PSState.Dead, new PS_DeadState(this)); m_CurrentEnumState = PSState.Dead; m_CurrentState = dict_States[m_CurrentEnumState]; m_CurrentState.Enter(); }