Пример #1
0
    /*
     * Handles damaging the player and all subsequent effects
     */
    public void ReceiveHit(EnemyController instigator)
    {
        timesHit += 1;

        if (timesHit > maxHits)
        {
            bIsDead = true;
            gameMode.PlayerDied(this);
            if (points > highScore)
            {
                highScore = points;
            }

            float gameTime = Time.time - gameStartTime;
            if (gameTime > longestGameTime)
            {
                longestGameTime = gameTime;
            }

            gameObject.SetActive(false);
        }
        else
        {
            verticalVelocity = 2.0f;
            bDoPhysics       = true;
        }

        // Do camera shake
        if (gameCamera != null)
        {
            gameCamera.DoCameraShake(1.0f, 25.0f);
        }

        // Do a little freeze on hit to dramaticize it
        gameMode.PauseGame();
        gameMode.SetTimer(gameMode.UnPauseGame, 0.3f);

        player_ui.DoScreenFlash(0.05f);
    }