/// <summary> /// This method ensures that there is only one instance /// of this state at any given time. If there is no instance /// then one is created. /// </summary> /// <returns>single instance of this state.</returns> public static GLumberjack_ChopWood GetInstance() { if (m_Instance == null) { m_Instance = new GLumberjack_ChopWood(); } return(m_Instance); }
public override void OnUpdate(GoblinLumberjack owner) { if (owner.GetTargetTree() == null) { //If there is no tree then go back to IDLE state owner.GetStateMachine().ChangeState(GLumberjack_IDLE.GetInstance()); return; } // If we are there, then proceed to chop tree. if (owner.IsAtDestination()) { // Transition to Chop Wood State. owner.GetStateMachine().ChangeState(GLumberjack_ChopWood.GetInstance()); } }