Пример #1
0
        private void LoadContent2vs2()
        {
            PlayerAndGameInfo currentGameMode = Game.CurrentGameMode;
            var teams      = currentGameMode.PlayerInfos.ToLookup(p => p.TeamIndex);
            var scoreTeam1 = Tuple.Create(teams[1].Sum(p => p.TotalScore), teams[1].Sum(p => p.NumberOfBoars), teams[1].Sum(p => p.NumberOfChickens));
            var scoreTeam2 = Tuple.Create(teams[2].Sum(p => p.TotalScore), teams[2].Sum(p => p.NumberOfBoars), teams[2].Sum(p => p.NumberOfChickens));

            bool   isDraw        = scoreTeam2.Item1 == scoreTeam1.Item1;
            string winningSuffix = isDraw ? "" : " wins";

            if (scoreTeam1.Item1 >= scoreTeam2.Item1)
            {
                CreateWinningImage("greenPurpleWins", "Team 1" + winningSuffix, scoreTeam1.Item1, scoreTeam1.Item2, scoreTeam1.Item3, new Vector2(0.25f, 0.5f), 0.5f, 0);
            }
            else
            {
                CreateLoosingImage("greenPurplelost", true, "Team 1", scoreTeam1.Item1, scoreTeam1.Item2, scoreTeam1.Item3, new Vector2(0.25f, 0.5f), 0.5f, 0);
            }


            if (scoreTeam2.Item1 >= scoreTeam1.Item1)
            {
                CreateWinningImage("yellowRedWins", "Team 2" + winningSuffix, scoreTeam2.Item1, scoreTeam2.Item2, scoreTeam2.Item3, new Vector2(0.75f, 0.5f), 0.5f, 0);
            }
            else
            {
                CreateLoosingImage("redyellowlost", true, "Team 2", scoreTeam2.Item1, scoreTeam2.Item2, scoreTeam2.Item3, new Vector2(0.75f, 0.5f), 0.5f, 0);
            }

            if (isDraw)
            {
                ShowMidText("It's a DRAW!");
            }
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // [FOREACH PERFORMANCE] ALLOCATES GARBAGE
            EngineComponents.AllServices.ForEach(a => a.LoadContent());
            Debug  = renderer2d.Debug;
            Camera = renderer2d.GameCamera;
            loadingScene.LoadContent();

            // set desired default resolution
            graphics.PreferredBackBufferWidth  = 1920;
            graphics.PreferredBackBufferHeight = 1080;

#if LINUX
            // No, thanks!
            graphics.IsFullScreen = false;
#else
            graphics.IsFullScreen = Settings <GameSettings> .Value.IsFullscreen; // fullscreen when not debugging
#endif
            // F11 to switch to fullscreen
            InputManager.AddGlobalHooks(new InputMapping(
                                            (f) => InputFunctions.FullScreen(f),
                                            (f) => ToggleFullscreen())
                                        );

            this.Window.AllowUserResizing = true;
            graphics.ApplyChanges();

            this.CurrentGameMode = new PlayerAndGameInfo(this);
            SwitchScene(new MainMenuScene(this));
        }