Exemplo n.º 1
0
        // turns game on
        public override void TurnOn()
        {
            if (myType == gameType.Timed)
            {
                gameTimer = new Timer(1);
                gameTimer.SetTimer(0, gameLength, delegate() { Winner(DetermineWinner()); ableToReBegin = false; ableToReBegin2 = false; /*time1.Fade(4);*/ time2.Fade(4); speedState = gameState.Winner; });

                /*time1 = new Text(gameTimer.getCountDown(0), _font);
                 * time1.height = 100;
                 * time1.attributes.position = new Vector2(yourName.attributes.position.X, oppName.attributes.position.Y);
                 * time1.isSeeable = true;
                 * time1.attributes.color = Color.Black;
                 * time1.attributes.depth = .02f;
                 * time1.scale = new Vector2(.15f, .15f);*/

                time2        = new Text(gameTimer.getCountDown(0), _font);
                time2.height = 100;
                time2.attributes.position = new Vector2(oppName.attributes.position.X, yourName.attributes.position.Y);
                time2.isSeeable           = true;
                time2.attributes.color    = Color.Black;
                time2.attributes.depth    = .02f;
                time2.scale = new Vector2(.12f, .12f);
            }
            Deal();
            base.TurnOn();
        }
Exemplo n.º 2
0
        // update method based on different gamestates
        public override void Update(GameTime gameTime)
        {
            if (base.isPaused)
            {
                return;
            }
            if (isHalted)
            {
                return;
            }
            if (speedState == gameState.GamePlay)
            {
                delayTimer.Update(gameTime);
            }
            if (myType == gameType.Timed)
            {
                //time1.changeContent(gameTimer.getCountDown(0));
                time2.changeContent(gameTimer.getCountDown(0));
                //if (speedState == gameState.GamePlay) delayTimer.Update(gameTime);
                if (speedState == gameState.ReBeginning && gameTimer.getTimeLeft(0) <= 20)
                {
                    gameTimer.isPaused = true;
                }
                else
                {
                    gameTimer.isPaused = false;
                }
            }

            switch (speedState)
            {
            case gameState.Dealing:
                if ((shuffleinstance.State == SoundState.Stopped) && soundOn)
                {
                    shuffleinstance.Play();
                }
                break;

            case gameState.AskBegin:
            case gameState.Beginning:
                DoNothing();
                break;

            case gameState.GamePlay:
                yourScore.changeContent(you.score.ToString());
                oppScore.changeContent(opp.score.ToString());
                if (ExistWinner())
                {
                    Winner(DetermineWinner());
                }
                else if (!ExistMoves())
                {
                    ReBegin();
                }
                you.Update(yourCards, rGameStack, lGameStack, gameTime);
                opp.Update(opponentCards, rGameStack, lGameStack, gameTime);
                yourSelector.attributes.position = yourCards[you.selector].position;
                oppSelector.attributes.position  = opponentCards[opp.selector].position;
                break;

            case gameState.ReBeginning:
            case gameState.PlayingCard:
                you.Update(yourCards, rGameStack, lGameStack, gameTime);
                opp.Update(opponentCards, rGameStack, lGameStack, gameTime);
                yourSelector.attributes.position = yourCards[you.selector].position;
                oppSelector.attributes.position  = opponentCards[opp.selector].position;
                break;

            case gameState.Winner:
                break;

            case gameState.PlayAgain:
                break;
            }
            //bool moveExists = ComputerPlayer.FindPileNumber(opponentCards, lGameStack, rGameStack);
            KeyUpdate(gameTime);
            base.Update(gameTime);
        }
Exemplo n.º 3
0
        // turns game on
        public override void TurnOn()
        {
            if (myType == gameType.Timed)
            {
                gameTimer = new Timer(1);
                gameTimer.SetTimer(0, gameLength, delegate() { Winner(DetermineWinner()); ableToReBegin = false; ableToReBegin2 = false; /*time1.Fade(4);*/ time2.Fade(4); speedState = gameState.Winner; });

                /*time1 = new Text(gameTimer.getCountDown(0), _font);
                time1.height = 100;
                time1.attributes.position = new Vector2(yourName.attributes.position.X, oppName.attributes.position.Y);
                time1.isSeeable = true;
                time1.attributes.color = Color.Black;
                time1.attributes.depth = .02f;
                time1.scale = new Vector2(.15f, .15f);*/

                time2 = new Text(gameTimer.getCountDown(0), _font);
                time2.height = 100;
                time2.attributes.position = new Vector2(oppName.attributes.position.X, yourName.attributes.position.Y);
                time2.isSeeable = true;
                time2.attributes.color = Color.Black;
                time2.attributes.depth = .02f;
                time2.scale = new Vector2(.12f, .12f);
            }
            Deal();
            base.TurnOn();
        }