Example #1
0
    // Update is called once per frame.
    void Update()
    {
        if (--targetChangeTimer < 0 && Input.GetKey(KeyCode.Space))
        {
            tracker.targetIndex = tracker.targetIndex == 1 ? targetSpotIndex : 1;
            targetChangeTimer   = 20;
            controller.ChangeTarget(tracker.targetIndex, false);
        }
        if (--sceneChangeTimer < 0 && Input.GetKey(KeyCode.LeftControl))
        {
            sceneChangeTimer = 20;
            if (targetSpotIndex == 0)
            {
                targetSpotIndex = 2;
                car1.SetActive(true);
                car2.SetActive(false);
                tracker.target[0].SetActive(false);
                tracker.target[2].SetActive(true);
            }
            else if (targetSpotIndex == 2)
            {
                targetSpotIndex = -1;
                car2.SetActive(true);
                tracker.target[2].SetActive(false);
            }
            else
            {
                targetSpotIndex = 0;
                car1.SetActive(false);
                tracker.target[0].SetActive(true);
            }

            if (tracker.targetIndex != 1)
            {
                tracker.targetIndex = targetSpotIndex;
                controller.ChangeTarget(targetSpotIndex, true);
            }
        }
    }