Ejemplo n.º 1
0
        public static int GetLives()
        {
            int          lives    = 0;
            ScoreManager scoreMan = ScoreManager.GetInstance();

            if (GetCurrentPlayer() == CurrentPlayer.Player1)
            {
                lives = GetScore(ScoreType.Player1Lives);
            }
            else
            {
                lives = GetScore(ScoreType.Player2Lives);
            }
            return(lives);
        }
Ejemplo n.º 2
0
        public static void UpdateCurrentPlayerScore(int value)
        {
            ScoreManager  scoreMan = ScoreManager.GetInstance();
            CurrentPlayer player   = GetCurrentPlayer();

            if (player == CurrentPlayer.Player1)
            {
                scoreMan.player1Score += value;
            }
            else if (player == CurrentPlayer.Player2)
            {
                scoreMan.player2Score += value;
            }
            else
            {
                Debug.Assert(false);
            }
        }
Ejemplo n.º 3
0
        public static void OneUp()
        {
            ScoreManager  scoreMan = ScoreManager.GetInstance();
            CurrentPlayer player   = GetCurrentPlayer();

            if (player == CurrentPlayer.Player1)
            {
                scoreMan.player1Lives += 1;
            }
            else if (player == CurrentPlayer.Player2)
            {
                scoreMan.player2Lives += 1;
            }
            else
            {
                Debug.Assert(false);
            }
        }
Ejemplo n.º 4
0
        public static int UpdateLives()
        {
            int           currentLives = 0;
            ScoreManager  scoreMan     = ScoreManager.GetInstance();
            CurrentPlayer player       = GetCurrentPlayer();

            if (player == CurrentPlayer.Player1)
            {
                scoreMan.player1Lives -= 1;
                currentLives           = scoreMan.player1Lives;
            }
            else if (player == CurrentPlayer.Player2)
            {
                scoreMan.player2Lives -= 1;
                currentLives           = scoreMan.player2Lives;
            }
            else
            {
                Debug.Assert(false);
            }
            return(currentLives);
        }
Ejemplo n.º 5
0
        public static int GetScore(ScoreType type)
        {
            int          score    = 0;
            ScoreManager scoreMan = ScoreManager.GetInstance();

            switch (type)
            {
            case ScoreType.Player1Score:
                score = scoreMan.player1Score;
                break;

            case ScoreType.Player2Score:
                score = scoreMan.player2Score;
                break;

            case ScoreType.HiScore:
                score = scoreMan.hiScore;
                break;

            case ScoreType.Player1Lives:
                score = scoreMan.player1Lives;
                break;

            case ScoreType.Player2Lives:
                score = scoreMan.player2Lives;
                break;

            case ScoreType.Credits:
                score = scoreMan.credits;
                break;

            default:
                Debug.Assert(false);
                break;
            }
            return(score);
        }
Ejemplo n.º 6
0
        public static void SetCurrentPlayer(CurrentPlayer newPlayer)
        {
            ScoreManager scoreMan = ScoreManager.GetInstance();

            scoreMan.currentPlayer = newPlayer;
        }
Ejemplo n.º 7
0
        public static CurrentPlayer GetCurrentPlayer()
        {
            ScoreManager scoreMan = ScoreManager.GetInstance();

            return(scoreMan.currentPlayer);
        }