Exemple #1
0
    void OnTriggerStay(Collider entity)
    {
        if (entity.tag == "Player")
        {
            if (enter.isPlayerHere == true)
            {
                if (Input.GetKeyDown(KeyCode.E))
                {
                    zip = true;
                }


                if (zip != true)
                {
                    msg.NewMessage(msgFrom, msgBody, msgTime);
                }
            }


            if (zip == true)
            {
                if (playerCamera.activeSelf != false)
                {
                    playerCamera.SetActive(false);
                    ziplineCamera.SetActive(true);
                }



                if (Input.GetKey(KeyCode.W))
                {
                    ziplineCamera.transform.parent.transform.Translate(Vector3.up * Time.deltaTime);
                    zipAnim.speed = 2;
                }
                else
                {
                    zipAnim.speed = 0;
                }


                if (exit.isPlayerHere == true)
                {
                    player.position = exitPos.position;
                    playerCamera.transform.position = exitPos.position;

                    if (playerCamera.activeSelf != true)
                    {
                        ziplineCamera.transform.parent.transform.position = startPos;
                        playerCamera.SetActive(true);
                        ziplineCamera.SetActive(false);
                        enter.isPlayerHere = false;
                        exit.isPlayerHere  = false;
                    }

                    zip = false;
                }
            }
        }
    }