// Update is called once per frame
    void FixedUpdate()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (!isChase)
            {
                isChase          = true;
                chaseCam.enabled = true;
                this.transform.SetParent(null);
                chaseCam.AttachToAnchor(traffic.GetComponentsInChildren <HovercarAnchor>().PickOne());
            }
            else
            {
                isChase          = false;
                chaseCam.enabled = false;
                this.transform.SetParent(startingParent);
                this.transform.localPosition = startingLocal;
                this.transform.LookAt(Vector3.up);
            }
        }

        if (Input.GetKeyDown(KeyCode.Tab) && isChase)
        {
            chaseCam.AttachToAnchor(traffic.GetComponentsInChildren <HovercarAnchor>().PickOne());
        }

        if (Input.GetKeyDown(KeyCode.P) && isChase)
        {
            if (player == null)
            {
                var car = Instantiate(PlayerCarPf, new Vector3(0f, 300f, -3000f), Quaternion.identity)
                          .GetComponent <HovercarAnchor>();
                player = car;
            }

            chaseCam.AttachToAnchor(player);
        }
    }
Example #2
0
 public void AttachToAnchor(HovercarAnchor anch)
 {
     targetShip        = anch;
     TargetView.Target = anch.TargetPoint;
 }