コード例 #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_MillTravel GetInstance()
        {
            if (m_Instance == null)
            {
                m_Instance = new GLumberjack_MillTravel();
            }

            return(m_Instance);
        }
コード例 #2
0
 public override void OnUpdate(GoblinLumberjack owner)
 {
     // Chop wood, what else could this be...
     owner.ChopWood();
     if (owner.IsDoneChoppingWood())
     {
         // Transition to wood mill travel state.
         owner.GetStateMachine().ChangeState(GLumberjack_MillTravel.GetInstance());
     }
 }
コード例 #3
0
        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.
        }