Exemplo n.º 1
0
    void LiftActivation()
    {
        // Increment the timer by the amount of time since the last frame.
        timer += Time.deltaTime;

        // If the timer is greater than the amount of time before the lift should start...
        if (timer >= timeToLiftStart)
        {
            // ... stop the player and the camera moving and parent the player to the lift.
            playerAnim.SetFloat(hash.speedFloat, 0f);
            camMovement.enabled     = false;
            player.transform.parent = transform;

            // Move the lift upwards.
            transform.Translate(Vector3.up * liftSpeed * Time.deltaTime);

            // If the audio clip isn't playing...
            if (!GetComponent <AudioSource>().isPlaying)
            {
                // ... play the clip.
                GetComponent <AudioSource>().Play();
            }

            // If the timer is greater than the amount of time before the level should end...
            if (timer >= timeToEndLevel)
            {
                // ... call the EndScene function.
                sceneFadeInOut.EndScene();
            }
        }
    }
Exemplo n.º 2
0
 void LevelReset()
 {
     timer += Time.deltaTime;
     if (timer >= resetAfterDeathtTime)
     {
         screenFadeInOut.EndScene();
     }
 }