private float restingTime;     // time elapsed since resting time started

        void Start()
        {
            // get the steerings that are going to be used by this FSM
            arrive = GetComponent <Arrive>();
            if (arrive == null)
            {
                Debug.LogError(gameObject + " has no Arrive attached in " + this);
            }

            pursue = GetComponent <Pursue>();
            if (pursue == null)
            {
                Debug.LogError(gameObject + " has no Pursue attached in " + this);
            }


            // get the internal state + world representation (the "BLACKBOARD")
            blackboard = GetComponent <BATCAT_Blackboard>();
            if (blackboard == null)
            {
                blackboard = gameObject.AddComponent <BATCAT_Blackboard>();
            }

            arrive.enabled = false;
            pursue.enabled = false;
        }
示例#2
0
        private float elapsedTime;     // time elapsed in EATING or RUMMAGING states

        void Start()
        {
            // get the steerings
            arrive = GetComponent <Arrive>();
            if (arrive == null)
            {
                Debug.LogError(gameObject + " has no Arrive attached in " + this);
            }

            wander = GetComponent <Wander>();
            if (wander == null)
            {
                Debug.LogError(gameObject + " has no Wander attached in " + this);
            }

            // get the blackboard
            blackboard = GetComponent <BATCAT_Blackboard>();
            if (blackboard == null)
            {
                blackboard = gameObject.AddComponent <BATCAT_Blackboard>();
            }
        }
        void Start()
        {
            // get the machines that are states
            jailing = GetComponent <FSM_BATCAT_JAILING>();
            if (jailing == null)
            {
                jailing = gameObject.AddComponent <FSM_BATCAT_JAILING> ();
            }
            jailing.enabled = false;

            feeding = GetComponent <FSM_BEE_POLLINATE>();
            if (feeding == null)
            {
                feeding = gameObject.AddComponent <FSM_BEE_POLLINATE> ();
            }
            feeding.enabled = false;

            // get the blackboard
            blackboard = GetComponent <BATCAT_Blackboard>();
            if (blackboard == null)
            {
                blackboard = gameObject.AddComponent <BATCAT_Blackboard>();
            }
        }