示例#1
0
        public static void UpdateHiScore()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            //thinking...........
            //get player 1 score
            //get player 2 score

            float fP1Score = pPMan.player1Score;
            float fP2Score = pPMan.player2Score;

            float fHiScore = pPMan.fHiScore;

            //check if either Score is higher than hiScore
            if (fP1Score >= fHiScore)
            {
                //if one of them is then update the new hiScore
                pPMan.fHiScore = fP1Score;
            }

            else if (fP2Score >= fHiScore)
            {
                //if one of them is then update the new hiScore
                pPMan.fHiScore = fP2Score;
            }

            else
            {
                // no one got better than highScore
            }
        }
示例#2
0
        public static float GetP2Lives()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            return(pPMan.player2Lives);
        }
示例#3
0
        public static Player GetCurrentPlayer()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            return(pPMan.CurrentPlayer);
        }
示例#4
0
        public static void P2TakeLife()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player2Score -= 1;
        }
示例#5
0
        public static float GetP2Score()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            return(pPMan.player1Score);
        }
示例#6
0
        //--------------------------------------------------
        //Player 2
        //--------------------------------------------------

        public static void SetP2Score(float points)
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player1Score += points;
        }
示例#7
0
        public static void P1TakeLife()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player1Lives -= 1;
        }
示例#8
0
        public static void ClearStuff()
        {
            PlayerMan pPMan = PlayerMan.PrivInstance();

            Debug.Assert(pPMan != null);

            pPMan.player1Lives = 3;
            pPMan.player1Score = 0;

            pPMan.player2Lives = 3;
            pPMan.player2Score = 0;
        }
示例#9
0
        public static void SetCurrentPlayer(Player player)
        {
            PlayerMan pPlayerMan = PlayerMan.PrivInstance();

            Debug.Assert(pPlayerMan != null);



            switch (player)
            {
            case PlayerMan.Player.Player1:
                pPlayerMan.CurrentPlayer = Player.Player1;
                break;

            case PlayerMan.Player.Player2:
                pPlayerMan.CurrentPlayer = Player.Player2;
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }