/// <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_TreeTravel GetInstance() { if (m_Instance == null) { m_Instance = new GLumberjack_TreeTravel(); } return(m_Instance); }
public override void OnUpdate(GoblinLumberjack owner) { owner.DepositWood(); if (owner.IsDoneDropingWood()) { // If we are done depositing then switch back to the // Tree Travel state to go back to our tree and continue // chopping wood. owner.GetStateMachine().ChangeState(GLumberjack_TreeTravel.GetInstance()); } }
public override void OnUpdate(GoblinLumberjack owner) { //If there is a target tree, then we wish to make the // gobling travel to it. if (owner.GetTargetTree() != null && !owner.IsDoneChoppingWood()) { // Transition to TreeTravel State. owner.GetStateMachine().ChangeState(GLumberjack_TreeTravel.GetInstance()); } else if (owner.GetTargetLumberMill() != null && !owner.IsDoneDropingWood()) { // Transition to Mill Travel State owner.GetStateMachine().ChangeState(GLumberjack_MillTravel.GetInstance()); } // Otherwise we do nothing. }