Esempio n. 1
0
        void Start()
        {
            demoController = FindObjectOfType <Demo2>();
            target         = demoController.GetTarget();
            if (target != null)
            {
                Transform[] positions = { target.transform };
                transformBehaviour.Positions = positions;
                mov.LookTarget = target;
            }


            AgentCommon ac = null;

            if (!TryGetComponent(out ac))
            {
                ac = gameObject.GetComponentInParent <AgentCommon>();
            }

            if (ac == null)
            {
                ac = gameObject.GetComponentInChildren <AgentCommon>();
            }

            if (ac != null)
            {
                dct = FindObjectsOfType <DemoCollisionTracker>().Where(colTracker => colTracker.DemoID == ac.DemoID).First();
            }
            else
            {
                Debug.LogWarning("Could not find a valid AgentCommon Component in colliding game object.");
            }
        }
 private void Start()
 {
     behaviour    = GetComponent <DotToNavmeshPath>();
     agentCommon  = GetComponent <AgentCommon>();
     lastPosition = transform.position;
     RecomputePath();
     StartCoroutine(StuckCheck());
 }