예제 #1
0
        /// <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_DepositWood GetInstance()
        {
            if (m_Instance == null)
            {
                m_Instance = new GLumberjack_DepositWood();
            }

            return(m_Instance);
        }
예제 #2
0
        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());
            }
        }