示例#1
0
    void OnTriggerStay(Collider col)
    {
        if (col.transform.parent.CompareTag("Player"))
        {
            float dist = (col.transform.position - transform.position).magnitude;

            if (dist != prevDist)
            {
                prevDist = dist;

                float percentage = dist / maxDist;

                if (percentage > 1.0f)
                {
                    percentage = 1.0f;
                }
                else if (percentage < 0.1f)
                {
                    percentage = 0.1f;
                }

                UpperFloorObjects.ChangeTransparency(percentage);
            }
        }
    }
示例#2
0
    void Update()
    {
        if (gameWon && InputManager.Instance.GetActionButton())
        {
            Time.timeScale = 1f;
            GoToNextLevel();
        }


        if (!alive) // Player is dead.
        {
            if (InputManager.Instance.GetRestartButton())
            {
                Time.timeScale = 1f;

                PlayerPrefs.SetInt("restarted", 1);

                UpperFloorObjects.EmptyList();
                SceneLoaderManager.Instance.ReloadScene(SceneManager.GetActiveScene());
            }
            if (InputManager.Instance.GetPauseButton())
            {
                Time.timeScale = 1f;
                ReturnMenu();
            }
        }
        else // Player is alive.
        {
            if (InputManager.Instance.GetPauseButton())
            {
                pauseCanvas.SetActive(!pauseCanvas.activeSelf);
            }
        }

        // Para Testing nomás.

        /*if (Input.GetKey(KeyCode.J))
         * {
         *  SaveLoad.Save();
         *  SceneLoaderManager.Instance.LoadNextScene(actualScene);
         * }*/
    }