public static void AddScore(int amount) { score += amount; float playerForwardVelocity = PlayerController.GetForwardVelocity(); if (playerForwardVelocity < 70f) { PlayerController.SetForwardVelocity(playerForwardVelocity * 1.25f * totalMult); } PlayerController.SetAngularVelocity(PlayerController.GetAngularVelocity() * 1.01f * totalMult); float spawnInterval = ObstacleSpawner.GetSpawnInterval(); if (spawnInterval > 10f) { ObstacleSpawner.SetSpawnInterval(spawnInterval - 0.1f * totalMult); } float holeRatioMin = ObstacleSpawner.GetHoleMin(); float holeRatioMax = ObstacleSpawner.GetHoleMax(); if (holeRatioMin > 0.2f) { ObstacleSpawner.SetHoleMin(holeRatioMin - 0.05f); ObstacleSpawner.SetHoleMax(holeRatioMax - 0.05f); } float rotationMultiplier = ObstacleBehaviour.GetRotationMultiplier(); if (rotationMultiplier < 50.0f) { ObstacleBehaviour.SetRotationMultiplier(rotationMultiplier + 0.05f * totalMult); } }
//------------------------- public void StartNewGame() { DisableUI(mainMenuUIGroup); DisableUI(gameUIGroup); EnableUI(gameUI); playerController.SetVisible(false); playerController.transform.position = Vector3.zero; playerController.SetVisible(true); ObstacleSpawner.DestroyAllObstacles(); ObstacleSpawner.StartSpawning(); GameManager.ResetScore(); ObstacleSpawner.SetSpawnInterval(80f); PlayerController.SetAngularVelocity(10f); PlayerController.SetAngularVelocity(10f); PlayerController.SetForwardVelocity(20f); ObstacleSpawner.SetHoleMin(0.6f); ObstacleSpawner.SetHoleMax(0.8f); ObstacleBehaviour.SetRotationMultiplier(100f); ObstacleSpawner.Reset(); isGameRunning = true; }