Пример #1
0
        // Starts a match with the players and type specified
        public void StartMatch(MatchType mt, List<PlayerIndex> index)
        {
            this.matchType = mt;

            // Reset
            Initialize();
            Reset();
            ResetBackground();

            if (matchType.Equals(MatchType.Arcade) || matchType.Equals(MatchType.Zones) || matchType.Equals(MatchType.Travel) || matchType.Equals(MatchType.Survival) || matchType.Equals(MatchType.ThinkFast))
            {
                int i = 0;
                PlayerCount = index.Count;

                // Add each player
                foreach (PlayerIndex pi in index)
                {
                    Pod Player = new Pod(pi, this);
                    if (i == 0)
                    {
                        if (PlayerCount == 1)
                        {
                            Player.Position = new Vector2(640, 360);
                        }
                        else
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 210);
                        }
                    }
                    else if (i == 1)
                    {
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 410);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                    }
                    else if (i == 2)
                    {
                        Player.Position = new Vector2(640, 410);
                    }
                    else if (i == 3)
                    {
                        Player.Position = new Vector2(640, 510);
                    }
                    Pods.Add(Player);
                    i++;
                }
            }
            else if (matchType.Equals(MatchType.Versus))
            {
                int i = 0;
                PlayerCount = index.Count;
                // Add each player
                foreach (PlayerIndex pi in index)
                {
                    Pod Player = new Pod(pi, this);
                    if (i == 0)
                    {
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 210);
                        }
                    }
                    else if (i == 1)
                    {
                        if (PlayerCount == 2)
                        {
                            Player.Position = new Vector2(640, 410);
                        }
                        else
                        {
                            Player.Position = new Vector2(640, 310);
                        }
                    }
                    else if (i == 2)
                    {
                        Player.Position = new Vector2(640, 410);
                    }
                    else if (i == 3)
                    {
                        Player.Position = new Vector2(640, 510);
                    }
                    Pods.Add(Player);
                    i++;

                    Player.Lives = 10;
                    Player.Energy = 100;
                }
            }

            StartEnemyWaves();

            // Start music
            MediaPlayer.Play(gameSong);

            // Temporarily disable high score connectivity (to avoid lag in the middle of a match)
            HighscoreComponent.Global.Enabled = false;
        }
Пример #2
0
        // Updates the point dot
        public void Update(GameTime gameTime)
        {
            // Moves the point dot
            if (AttractingPod == null)
            {
                Position += Velocity;
            }
            else
            {
                Position += (AttractingPod.Position - Position) / 4.0f;

                if (AttractingPod.IsRespawning || Vector2.Distance(AttractingPod.Position, Position) > 50)
                {
                    AttractingPod = null;
                }
            }

            // Rotates the point dot
            Rotation += (MathHelper.Pi / 100) * Velocity.X;

            TimeAlive += gameTime.ElapsedGameTime.Milliseconds;

            if (TimeAlive > 4000)
            {
                Alpha -= 0.05f;
            }
        }