Esempio n. 1
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            GameObject goObserver = this.observer.GetGameObject(target);
            GameObject goTarget   = this.target.GetGameObject(target);

            if (goObserver == null)
            {
                return(false);
            }
            if (goTarget == null)
            {
                return(false);
            }

            Perception perception = goObserver.GetComponentInChildren <Perception>();

            if (perception == null)
            {
                return(false);
            }

            switch (this.operation)
            {
            case Operation.StartTracking:
                perception.StartListenPerceptron(Perception.Type.Sight, goTarget, null);
                break;

            case Operation.StopTracking:
                perception.StopListenPerceptron(Perception.Type.Sight, goTarget, null);
                break;
            }

            return(true);
        }
Esempio n. 2
0
        private void Start()
        {
            GameObject goObserver = this.observer.GetGameObject(gameObject);
            GameObject goTarget   = this.target.GetGameObject(gameObject);

            if (goObserver != null && goTarget != null)
            {
                Perception sensesObserver = goObserver.GetComponent <Perception>();
                if (sensesObserver == null)
                {
                    return;
                }

                sensesObserver.StartListenPerceptron(Perception.Type.Sight, goTarget, this.Callback);
            }
        }