public override void OnUpdate(GoblinLumberjack owner) { // If the goblin has reached its destination. if (owner.IsAtDestination()) { // Make the goblin go idle. owner.GetStateMachine().ChangeState(GLumberjack_IDLE.GetInstance()); } }
/// <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_IDLE GetInstance() { if (m_Instance == null) { m_Instance = new GLumberjack_IDLE(); } return(m_Instance); }
public override void OnUpdate(GoblinLumberjack owner) { if (owner.GetTargetLumberMill() == null) { // if there is no mill the move to the IDLE State owner.GetStateMachine().ChangeState(GLumberjack_IDLE.GetInstance()); return; } if (owner.IsAtDestination()) { //If we arrived at the mill, go to deposit state. owner.GetStateMachine().ChangeState(GLumberjack_DepositWood.GetInstance()); } }
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()); } }