void SpawnPlatform() { MovingPlatform platform = _movingPlatformProvider.GetRandomPlatform(); ResetPlatform(platform); platform.gameObject.SetActive(true); if (!_highScoreSurpassed && _spawnedPlatformsCount == _highScoreController.HighScore) // About to surpass current high score { platform.ChangeMaterial(_platformHighScoreMaterial); _highScoreSurpassed = true; } _spawnedPlatformsCount++; }
void ResetPlatform(MovingPlatform platform) { platform.transform.SetPositionAndRotation(_initialPlatformPosition.position, Quaternion.identity); platform.ChangeMaterial(_platformDefaultMaterial); }