Exemple #1
0
    void FixedUpdate()
    {
        _playerMover.Step(_movementDirection, Input.GetKey(KeyCode.Space));

        _ableToShoot = (_layersPreventingShooting.value & (1 << _playerMover.LatestStandingLayer)) == 0;

        // Handle falling below the death elevation and respawning.
        if (!_respawning && _playerMover.Position.y < _deathElevation)
        {
            _respawning = true;
            ScoreTracker.DeathCount++;
            var fader = FindObjectOfType <CameraFader>();
            fader.FadeOut(() => {
                _playerMover.SetPosition(CheckpointController.LatestPosition);
                GameObjectUtils.DestroyAll <PlatformController>();
                fader.FadeIn();
                _respawning = false;
            });
        }
    }