Beispiel #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.");
            }
        }
Beispiel #2
0
        private void Start()
        {
            if (DemoID != null)
            {
                var dctArr = FindObjectsOfType <DemoCollisionTracker>();
                dct = dctArr.Where(colTracker => colTracker.DemoID == DemoID).First();
            }



            baseMaterial = childRenderer.material;
            StartCoroutine(collisionDelay());
        }
Beispiel #3
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.CompareTag("Agent"))
            {
                if (DemoID == null)
                {
                    DemoID = other.gameObject.GetComponent <AgentCommon>()?.DemoID;
                    dct    = FindObjectsOfType <DemoCollisionTracker>().Where(colTracker => colTracker.DemoID == DemoID).First();
                }

                dct?.GoalAchieved();


                if (jumpIndex == jumpPoints.Length)
                {
                    jumpIndex = 0;
                }
                transform.localPosition = jumpPoints[jumpIndex];
                jumpIndex++;
            }
        }