// 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(); }
// Constructor public PS_IdleState(PlayerSquadFSM para_playerSquadFSM, PS_Logicaliser para_Brain) { m_psFSM = para_playerSquadFSM; m_Brain = para_Brain; }
// 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(); }