コード例 #1
0
    void Initialize()
    {
        _pausable   = true;
        _isGameLost = false;
        _score      = 0;

        _platformsSpeed = _gameSettings.InitialPlatformsSpeed;
        _playerSpeed    = _gameSettings.InitialPlayerSpeed;

        _timeElapsed      = 0f;
        _timeNextPlatform = 1f / _gameSettings.SpawnRate;

        _spawnedPlatformsCount = 0;
        _highScoreSurpassed    = false;

        WriteScoreToText(_currentScoreTextUI);
        DisplayInfoText(false);

        foreach (MovingPlatform platform in _movingPlatformsList)
        {
            platform.gameObject.SetActive(false);
            platform.CollidedWithTargets[0].ResetCollided();
            platform.CollidedWithTargets[1].ResetCollided();
        }

        _spawnPlatformTrigger.ResetCollided();
        _boundaryUpTrigger.ResetCollided();
        _boundaryDownTrigger.ResetCollided();

        _highScoreController.LoadCurrentHighScore();
        _highScoreController.WriteHighScoreOnText(_highScoreTextMenu);

        _mainCharacter.Initialize();
        _movingPlatformProvider.Initialize();
    }