示例#1
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            this.playField.ClipToBounds = true;
            this.UpdatePlayFieldSize();
            this.game = new Game(this.points, this.Dispatcher, this.screenRect, this.playField);

            timeBeginPeriod(timerResolution);
            var myGameThread = new Thread(this.game.GameThread);

            myGameThread.SetApartmentState(ApartmentState.STA);
            myGameThread.Start();

            FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Kinect Fun!");
            BannerText.NewBanner(
                Properties.Resources.Vocabulary,
                this.bannerRect,
                true,
                Color.FromArgb(200, 255, 255, 255));
        }
示例#2
0
        private void CheckPlayers()
        {
            foreach (var player in this.players)
            {
                if (!player.Value.IsAlive)
                {
                    // Player left scene since we aren't tracking it anymore, so remove from dictionary
                    this.players.Remove(player.Value.GetId());
                    break;
                }
            }

            // Count alive players
            int alive = this.players.Count(player => player.Value.IsAlive);

            if (alive != this.PlayersAlive)
            {
                if (alive == 2)
                {
                    this.SetGameMode(GameMode.TwoPlayer);
                }
                else if (alive == 1)
                {
                    this.SetGameMode(GameMode.OnePlayer);
                }
                else if (alive == 0)
                {
                    this.SetGameMode(GameMode.Off);
                }

                if (this.PlayersAlive == 0)
                {
                    BannerText.NewBanner(
                        Properties.Resources.Vocabulary,
                        this.rect,
                        true,
                        Color.FromArgb(200, 255, 255, 255));
                    this.GameIsStarted = false;
                }

                this.PlayersAlive = alive;
            }
        }