示例#1
0
    private void Update()
    {
        if (!(_doingRestorePower || _doingDrainPower))
        {
            _currentTime -= Time.deltaTime;
        }

        if (_currentTime < emergencyThreshold)
        {
            if (!_isEmergency)
            {
                vignette.SetActive(true);
                gradient.Invoke();
            }
            _isEmergency = true;
        }
        else
        {
            vignette.SetActive(false);
            _isEmergency = false;
        }
        if (_currentTime <= 0)
        {
            _currentTime = 0;
            playerDeath.KillPlayer();
            lose.SetActive(true);
            controller.enabled = false;
        }
        //  _doingDrainPower = false;
        // _doingRestorePower = false;
    }
示例#2
0
    private void OnTriggerEnter(Collider other)
    {
        referenceManager     = GameObject.Find("Managers").GetComponent <ReferenceManager>();
        player               = referenceManager.player;
        playerDeathScript    = referenceManager.deathManager.GetComponent <PlayerDeath>();
        quakeSafeZoneManager = quakeSafeZoneManager.GetComponent <QuakeSafeZoneManager>();

        if (enabled && !quakeSafeZoneManager.playerInSafeZone)
        {
            Debug.Log("You were hit by a door during the earthquake!");
            playerDeathScript.KillPlayer(this.gameObject, 3);
        }
        if (aftershock && quakeSafeZoneManager.playerInSafeZone)
        {
            Debug.Log("You tried entering and the house collapsed due to an after shock!");
            playerDeathScript.KillPlayer(this.gameObject, 6);
        }
    }
示例#3
0
    void Update()
    {
        // if we're not already ready for a quake or the first quake has already been completed
        if (!isQuakeTime && !firstQuakeCompleted && !automaticAftershock)
        {
            CheckForQuakeStart();
        }
        // if we're in the middle of the first quake
        else if (quaking && !automaticAftershock)
        {
            if (!isUnderCover)
            {
                CheckForQuakeDeath();
                CheckForUnderCover();
            }
            else if (!hasBeenUnderCover)
            {
                StartCoroutine(nameof(UnderCoverCountdown), secondsUnderCover);
                hasBeenUnderCover = true;
            }
            else if (hasBeenUnderCover)
            {
                CheckForUnderCover();
                playerMoverScript.SetCrouching(false);
                if (!isUnderCover)
                {
                    Debug.Log("Player exited the table and should be killed");
                    playerDeathScript.KillPlayer(this.gameObject, 5);
                }
            }
        }
        // if we're not in the middle of the quake, the player hasn't exited the house, and there hasn't already been an aftershock
        else if (!quaking && !quakeSafeZoneManager.playerInSafeZone && (!isAftershockTime || automaticAftershock))
        {
            CheckForAftershockStart();
        }

        if ((isQuakeTime && !quaking) || (isAftershockTime && !quaking))
        {
            TriggerQuake();
        }
    }