Exemplo n.º 1
0
 private void OnCollisionStay(Collision collision)
 {
     if (collision.gameObject.tag == "Bush")
     {
         if (Input.GetMouseButtonDown(1))
         {
             Debug.Log("Collided");
             this.gameObject.SetActive(false);
             OnPlayerHide?.Invoke();
             canMove = false;
         }
     }
 }
Exemplo n.º 2
0
 private void OnCollisionStay(Collision collision)
 {
     if (collision.gameObject.tag == "Bush")
     {
         if (Input.GetMouseButtonDown(1))
         {
             Debug.Log("Collided");
             Camera.main.transform.SetParent(collision.transform);
             Vector3 pos = collision.transform.position;
             pos.z -= 2;
             Camera.main.transform.position = pos;
             Camera.main.GetComponent <ThirdPersonCameraControl>().Target = collision.transform.GetChild(0);
             Camera.main.GetComponent <ThirdPersonCameraControl>().Player = collision.transform;
             Camera.main.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
             collision.gameObject.AddComponent <Rigidbody>();
             this.gameObject.SetActive(false);
             OnPlayerHide?.Invoke();
             canMove = false;
         }
     }
 }