Exemple #1
0
        public override void DoAction()
        {
            if (Game.CurrentGameMode == VTankObject.GameMode.CAPTURETHEBASE)
            {
                Game.Bases.ResetBases();
                Game.Scores.AddRoundWin(winner);
                string message = "The " + winner.ToString().ToLower() + " team has won the round!";

                Game.Chat.AddMessage(message, Color.Chartreuse);

                // Force players to look toward the next base.
                const int BLUE           = 10;
                const int RED            = 11;
                Base      blueBase       = Game.Bases.GetBase(BLUE);
                Base      redBase        = Game.Bases.GetBase(RED);
                float     angleRedToBlue = (float)Math.Atan2(
                    blueBase.Position.Y - redBase.Position.Y,
                    blueBase.Position.X - redBase.Position.X);
                float angleBlueToRed = (float)Math.Atan2(
                    redBase.Position.Y - blueBase.Position.Y,
                    redBase.Position.X - blueBase.Position.X);

                foreach (PlayerTank player in Game.Players.Values)
                {
                    bool isRed = player.Team == GameSession.Alliance.RED;
                    if (isRed)
                    {
                        player.Angle = angleRedToBlue;
                    }
                    else
                    {
                        player.Angle = angleBlueToRed;
                    }

                    if (player != Game.LocalPlayer)
                    {
                        player.TurretAngle = player.Angle;
                    }
                }
                Game.Scene.LockCameras();
            }
        }
Exemple #2
0
        /// <summary>
        /// Add a round victory to a given team's score.
        /// </summary>
        /// <param name="team">The team to award a round win to.</param>
        public void AddRoundWin(GameSession.Alliance team)
        {
            if (team == GameSession.Alliance.NONE)
            {
                return;
            }

            //Red is 1, Blue is 2
            if (team == GameSession.Alliance.RED)
            {
                team1stats.roundWins++;
            }
            else if (team == GameSession.Alliance.BLUE)
            {
                team2stats.roundWins++;
            }

            drawingRoundWinner = true;
            roundWinningTeam   = team.ToString().ToLower();
        }