public void ResetGame() { _currentBallCount = _startingBallCount; Tilt = false; Autosave = false; ShootAgain = false; _extraBallSpawner.Deactivate(); _status.ResetStatus(); _resources = 0; _pinballs = new List <Pinball>(FindObjectsOfType <Pinball>()); _activeBalls = _pinballs.Count; Debug.Log("Total balls : " + _currentBallCount.ToString()); Debug.Log("Initial balls : " + _activeBalls.ToString()); ResetAllPinballs(); //SetPinballPhysicsEnabled(false); Viewscreen.BallCount(CurrentBallNumber); }
private void RemoveBall(Pinball pinball) { if (!OutOfBalls) { // Returns the ball next to the launcher // and gets whether the ball is lost InstanceNextBall(pinball); _currentBallCount--; if (_currentBallCount == 1) { if (GameManager.Instance.GameMode.State == GameModeStateType.Sampo) { GameManager.Instance.GameMode. Owner.PerformTransition(GameModeStateType.Normal); // TODO: Reset collectable chances } } else if (OutOfBalls) { Viewscreen.OutOfBalls(); Debug.Log("Out of balls - game over"); //GameManager.Instance.SaveOrRevertHighscores(true); // The game is ended by ScreenState_Play } else { Viewscreen.BallCount(CurrentBallNumber); Debug.Log("Balls left: " + _currentBallCount.ToString()); } } else { Debug.Log("Out of balls"); } }