Example #1
0
            public void SpawnDrone(TPlayer player, int id)
            {
                Area  area = GlobalGame.GetCameraArea();
                float x    = GlobalRandom.Next((int)(area.Left + area.Width / 5), (int)(area.Right - area.Width / 5));
                float y    = area.Top + 10;

                CreateTurret(id, new Vector2(x, y), player.User.GetPlayer().FacingDirection, player.Team);
                GlobalGame.PlayEffect("EXP", new Vector2(x, y));
                GlobalGame.PlaySound("Explosion", new Vector2(x, y), 1.0f);
            }
Example #2
0
        public static void SpawnDrone(int id, PlayerTeam team)
        {
            Area  area = GlobalGame.GetCameraArea();
            float x    = GlobalRandom.Next((int)(area.Left + area.Width / 5), (int)(area.Right - area.Width / 5));
            float y    = area.Top - 10;

            CreateTurret(id, new Vector2(x, y), 1, team);
            GlobalGame.PlayEffect("EXP", new Vector2(x, y));
            GlobalGame.PlaySound("Explosion", new Vector2(x, y), 1.0f);
        }
Example #3
0
            public void FlashbangExplosion()
            {
                PlayExplosionVisualEffects();
                GlobalGame.PlaySound("Explosion", Position, 1);

                StunPlayersInRangeNotCoveredByWall();

                ThrownWeaponObject.Remove();
                ReadyForRemove = true;
            }
Example #4
0
 public bool StopBleedingSelf(TPlayer player)
 {
     if (player.Bleeding)
     {
         GlobalGame.PlaySound("GetHealthSmall", player.User.GetPlayer().GetWorldPosition(), 1);
         player.Bleeding = false;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #5
0
            public void Update()
            {
                for (int i = 0; i < PlayerList.Count; i++)
                {
                    IPlayer pl = PlayerList[i].User.GetPlayer();
                    if (pl != null && !pl.IsDead)
                    {
                        if (TestDistance(pl.GetWorldPosition(), Object.GetWorldPosition(), CapturePointRadius))
                        {
                            if (pl.GetTeam() == PlayerTeam.Team1)
                            {
                                if (CaptureProgress < MaxCapturePointProgress)
                                {
                                    CaptureProgress++;
                                    PlayerList[i].AddExp(0.05f, 2);
                                    if (CaptureProgress == MaxCapturePointProgress - 5)
                                    {
                                        GlobalGame.PlaySound("MenuOK", pl.GetWorldPosition(), 1f);
                                    }
                                }
                            }
                            else
                            {
                                if (CaptureProgress > -MaxCapturePointProgress)
                                {
                                    CaptureProgress--;
                                    PlayerList[i].AddExp(0.05f, 2);
                                    if (CaptureProgress == -MaxCapturePointProgress + 5)
                                    {
                                        GlobalGame.PlaySound("MenuOK", pl.GetWorldPosition(), 1f);
                                    }
                                }
                            }
                        }
                    }
                }
                float percent = ((float)Math.Abs(CaptureProgress)) / ((float)MaxCapturePointProgress);
                byte  color   = (byte)(255f * percent);

                if (CaptureProgress >= 0)
                {
                    Object.SetTextColor(new Color((byte)(255 - color), (byte)(255 - color), 255));
                }
                else
                {
                    Object.SetTextColor(new Color(255, (byte)(255 - color), (byte)(255 - color)));
                }
            }
Example #6
0
 public bool StopBleedingNear(TPlayer player)
 {
     for (int i = 0; i < PlayerList.Count; i++)
     {
         TPlayer pl = PlayerList[i];
         if (pl.User.GetPlayer() != null && pl.Status == 0 && pl.Bleeding == true &&
             pl.Team == player.Team && TestDistance(player.User.GetPlayer().GetWorldPosition(), pl.User.GetPlayer().GetWorldPosition(), 10))
         {
             GlobalGame.PlaySound("GetHealthSmall", player.User.GetPlayer().GetWorldPosition(), 1);
             pl.Bleeding = false;
             player.AddExp(2.5f, 1);
             return(true);
         }
     }
     return(false);
 }
Example #7
0
            public void DrawJetPackEffect(TPlayer player)
            {
                IPlayer pl  = player.User.GetPlayer();
                Vector2 vel = pl.GetLinearVelocity();
                Vector2 pos = pl.GetWorldPosition();

                if (vel.Y < 0)
                {
                    pos.Y -= 6;
                    GlobalGame.PlayEffect("FIRE", pos + new Vector2(10, 0));
                    GlobalGame.PlayEffect("FIRE", pos - new Vector2(10, 0));
                }
                else
                {
                    pos.Y -= 8;
                    GlobalGame.PlayEffect("FIRE", pos);
                }
                GlobalGame.PlaySound("Flamethrower", pos, 1f);
            }
Example #8
0
 public bool RevivePlayer(TPlayer player)
 {
     for (int i = 0; i < PlayerList.Count; i++)
     {
         TPlayer pl = PlayerList[i];
         if (!pl.CanRevive())
         {
             continue;
         }
         if (pl.Team == player.Team && TestDistance(player.User.GetPlayer().GetWorldPosition(), pl.User.GetPlayer().GetWorldPosition(), 10))
         {
             GlobalGame.PlaySound("GetHealthSmall", player.User.GetPlayer().GetWorldPosition(), 1);
             pl.Revive(pl.ReviveHealth);
             player.AddExp(5, 1);
             return(true);
         }
     }
     return(false);
 }
Example #9
0
            public bool CallPinpointStrike(TPlayer player)
            {
                int        angle = 0;
                PlayerTeam team  = player.Team;

                if (IsHacking(player.Team))
                {
                    team = GetEnemyTeam(player.Team);
                    GlobalGame.RunCommand("MSG PINPOINT STRIKE HAS BEEN HACKED");
                }
                Vector2 target = GetRandomAirEnemy(team, 1, ref angle);

                if (target.X == 0 && target.Y == 0)
                {
                    if (IsHacking(player.Team))
                    {
                        target = GetRandomWorldPoint();
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (IsJamming(player.Team))
                {
                    target.X += GlobalRandom.Next(-99, 100);
                    GlobalGame.RunCommand("MSG PINPOINT STRIKE HAS BEEN JAMMED");
                }
                else
                {
                    target.X += GlobalRandom.Next(-12, 13);
                }
                Vector2 position = GetBeginPointTarget(target, angle);

                GlobalGame.SpawnProjectile(ProjectileItem.BAZOOKA, position, (target - position));
                GlobalGame.PlaySound("Explosion", position, 1);
                return(true);
            }
Example #10
0
            public void CreateProjectile(TTurretWeapon weapon)
            {
                float   angle = MainBlock.GetAngle() + MainBlockAngle + GlobalRandom.Next(-weapon.Scatter, weapon.Scatter + 1) / 180.0f * (float)Math.PI;
                Vector2 pos   = MainMotor.GetWorldPosition();
                Vector2 dir   = new Vector2((float)Math.Cos(angle) * 10, (float)Math.Sin(angle) * 10);

                if (weapon.BulletType >= 0)
                {
                    GlobalGame.SpawnProjectile((ProjectileItem)weapon.BulletType, pos + dir, dir);
                }
                else if (weapon.BulletType == -1)
                {
                    GlobalGame.SpawnFireNode(pos + dir, dir * 2, FireNodeType.Flamethrower);
                }
                else if (weapon.BulletType == -2)
                {
                    ElectricExplosion(MainMotor.GetWorldPosition(), 20, 50);
                }
                else if (weapon.BulletType == -3)
                {
                    ForceImpulse(MainMotor.GetWorldPosition(), 10, 50);
                }
                GlobalGame.PlaySound(weapon.Sound, MainMotor.GetWorldPosition(), 1.0f);
            }
Example #11
0
            public void Use(TPlayer player)
            {
                if (Reloading > 0 || FastReloading > 0 || CurrentAmmo <= 0)
                {
                    return;
                }
                switch (Id)
                {
                case 1:
                {
                    if (RevivePlayer(player))
                    {
                    }
                    else if (StopBleedingSelf(player))
                    {
                    }
                    else if (StopBleedingNear(player))
                    {
                    }
                    else
                    {
                        return;
                    }
                    MinusAmmo();
                    break;
                }

                case 2:
                {
                    if (RevivePlayer(player))
                    {
                    }
                    else if (StopBleedingSelf(player))
                    {
                    }
                    else if (StopBleedingNear(player))
                    {
                    }
                    else
                    {
                        return;
                    }
                    Reloading = 5;
                    MinusAmmo();
                    break;
                }

                case 3:
                {
                    if (!IsJamming(player.Team))
                    {
                        CallAirDrop(player);
                        MinusAmmo();
                    }
                    break;
                }

                case 4:
                {
                    if (!ReloadUse && !IsActive)
                    {
                        if (!IsJamming(player.Team))
                        {
                            ReloadUse = true;
                            Reloading = 3;
                            GlobalGame.RunCommand("MSG NAPALM STRIKE IS COMING");
                        }
                    }
                    else
                    {
                        if (!IsHacking(player.Team))
                        {
                            IsActive = true;
                        }
                        else
                        {
                            MinusAmmo();
                            GlobalGame.RunCommand("MSG NAPALM STRIKE HAS BEED HACKED");
                        }
                    }
                    break;
                }

                case 5:
                {
                    if (!ReloadUse)
                    {
                        if (CheckAirPlayer(player, 1) && !IsJamming(player.Team))
                        {
                            ReloadUse = true;
                            Reloading = 3;
                            if (player.Team == PlayerTeam.Team1)
                            {
                                GlobalGame.RunCommand("MSG BLUE TEAM CALLED PINPOINT STRIKE");
                            }
                            else
                            {
                                GlobalGame.RunCommand("MSG RED TEAM CALLED PINPOINT STRIKE");
                            }
                        }
                    }
                    else
                    {
                        if (!CallPinpointStrike(player))
                        {
                            GlobalGame.RunCommand("MSG PINPOINT STRIKE: TARGET LOST");
                            ReloadUse = false;
                            Reloading = 5;
                        }
                        else
                        {
                            MinusAmmo();
                        }
                    }
                    break;
                }

                case 6:
                {
                    if (!IsActive)
                    {
                        if (!ReloadUse)
                        {
                            if (CheckAirPlayer(player, 2) && !IsJamming(player.Team))
                            {
                                ReloadUse = true;
                                Reloading = 3;
                                if (player.Team == PlayerTeam.Team1)
                                {
                                    GlobalGame.RunCommand("MSG BLUE TEAM CALLED AIRSTRIKE");
                                }
                                else
                                {
                                    GlobalGame.RunCommand("MSG RED TEAM CALLED AIRSTRIKE");
                                }
                            }
                        }
                        else
                        {
                            if (CallAirstrike(player))
                            {
                                IsActive = true;
                            }
                            else
                            {
                                GlobalGame.RunCommand("MSG AIRSTRIKE: TARGET LOST");
                                ReloadUse = false;
                                Reloading = 5;
                            }
                        }
                    }
                    break;
                }

                case 7:
                {
                    if (!IsJamming(player.Team))
                    {
                        CallAirDrop(player, 3);
                        MinusAmmo();
                    }
                    break;
                }

                case 8:
                {
                    if (!ReloadUse && !IsActive)
                    {
                        if (!IsJamming(player.Team))
                        {
                            ReloadUse = true;
                            Reloading = 3;
                            GlobalGame.RunCommand("MSG ARTILLERY STRIKE IS COMING");
                        }
                    }
                    else
                    {
                        if (!IsHacking(player.Team))
                        {
                            IsActive = true;
                        }
                        else
                        {
                            MinusAmmo();
                            GlobalGame.RunCommand("MSG ARTILLERY STRIKE HAS BEED HACKED");
                        }
                    }
                    break;
                }

                case 9:
                {
                    if (!ReloadUse && !IsActive)
                    {
                        if (!IsJamming(player.Team))
                        {
                            ReloadUse = true;
                            Reloading = 3;
                            GlobalGame.RunCommand("MSG MINE STRIKE IS COMING");
                        }
                    }
                    else
                    {
                        if (!IsHacking(player.Team))
                        {
                            IsActive = true;
                        }
                        else
                        {
                            MinusAmmo();
                            GlobalGame.RunCommand("MSG MINE STRIKE HAS BEED HACKED");
                        }
                    }
                    break;
                }

                case 10:
                {
                    if (!IsJamming(player.Team))
                    {
                        CallReinforcement(player);
                        SetId(0);
                        if (player.Team == PlayerTeam.Team1)
                        {
                            GlobalGame.RunCommand("MSG BLUE TEAM CALLED REINFORCEMENT");
                        }
                        else
                        {
                            GlobalGame.RunCommand("MSG RED TEAM CALLED REINFORCEMENT");
                        }
                    }
                    break;
                }

                case 11:
                {
                    TeamJamming[(int)player.Team - 1] += 10;
                    MinusAmmo();
                    if (player.Team == PlayerTeam.Team1)
                    {
                        GlobalGame.RunCommand("MSG BLUE TEAM ENABLE SUPPLY JAMMER");
                    }
                    else
                    {
                        GlobalGame.RunCommand("MSG RED TEAM ENABLE SUPPLY JAMMER");
                    }
                    break;
                }

                case 12:
                {
                    TeamHacking[(int)player.Team - 1] += 10;
                    MinusAmmo();
                    if (player.Team == PlayerTeam.Team1)
                    {
                        GlobalGame.RunCommand("MSG BLUE TEAM ENABLE SUPPLY HACKING");
                    }
                    else
                    {
                        GlobalGame.RunCommand("MSG RED TEAM ENABLE SUPPLY HACKING");
                    }
                    break;
                }

                case 13:
                {
                    MinusAmmo();
                    PlaceTurret(player, 0);
                    break;
                }

                case 14:
                {
                    MinusAmmo();
                    PlaceTurret(player, 1);
                    break;
                }

                case 15:
                {
                    MinusAmmo();
                    PlaceTurret(player, 2);
                    break;
                }

                case 16:
                {
                    MinusAmmo();
                    PlaceTurret(player, 3);
                    break;
                }

                case 18:
                {
                    if (!ReloadUse)
                    {
                        if (player.IsAdrenaline)
                        {
                            MinusAmmo();
                        }
                        else
                        {
                            ReloadUse                     = true;
                            Reloading                     = 5;
                            ForceShowReloading            = true;
                            player.IsAdrenaline           = true;
                            player.AdrenalineDamageFactor = 0.2f;
                            player.DamageDelaySpeed       = 1;
                            GlobalGame.PlaySound("GetHealthSmall", player.Position, 1);
                        }
                    }
                    else
                    {
                        player.IsAdrenaline = false;
                        MinusAmmo();
                    }
                    break;
                }

                case 19:
                {
                    MinusAmmo();
                    PlaceShieldGenerator(player);
                    break;
                }

                case 21:
                {
                    MinusAmmo();
                    SpawnStreetsweeper(player);
                    break;
                }

                case 22:
                {
                    MinusAmmo();
                    SpawnDrone(player, 7);
                    break;
                }

                case 23:
                {
                    MinusAmmo();
                    SpawnDrone(player, 6);
                    break;
                }

                case 24:
                {
                    MinusAmmo();
                    SpawnDrone(player, 5);
                    break;
                }

                case 25:
                {
                    MinusAmmo();
                    SpawnDrone(player, 4);
                    break;
                }
                }
            }
Example #12
0
        /* CLASS STARTS HERE - COPY BELOW INTO THE SCRIPT WINDOW */

        #region Timer Methods
        public void OnBeginTimer(TriggerArgs args)
        {
            if (TimeToStart > 0)
            {
                TimeToStart--;
            }
            if (GameState == 0)
            {
                int readyPlayers = 0;
                for (int i = 0; i < PlayerMenuList.Count; i++)
                {
                    if (PlayerMenuList[i].Ready)
                    {
                        readyPlayers++;
                    }
                }
                if (TimeToStart > 15 && (float)readyPlayers / (float)PlayerList.Count >= 2.0 / 3.0)
                {
                    TimeToStart = 15;
                }
                if (readyPlayers == PlayerList.Count)
                {
                    TimeToStart = 0;
                }
                if (TimeToStart <= 10)
                {
                    BeginTimer.SetTextColor(Color.Red);
                    GlobalGame.PlaySound("TimerTick", new Vector2(0, 600), 1.0f);
                }
                BeginTimer.SetText("Choose your equipment: " + TimeToStart.ToString());
                if (TimeToStart == 0)
                {
                    GameState = 1;
                    Game.RunCommand("MSG BEST OF " + RoundsPerMapPart + " WINS!");
                    BeginTimer.SetText("");
                }
            }

            else if (GameState == 3)
            {
                for (int i = 0; i < PlayerList.Count; i++)
                {
                    PlayerList[i].ReloadEquipment();
                }
                for (int i = 0; i < TeamJamming.Length; i++)
                {
                    if (TeamJamming[i] > 0)
                    {
                        TeamJamming[i]--;
                        if (TeamJamming[i] == 0)
                        {
                            if (i == 0)
                            {
                                Game.RunCommand("MSG RED TEAM DISABLE SUPPLY JAMMER");
                            }
                            else
                            {
                                Game.RunCommand("MSG BLUE TEAM DISABLE SUPPLY JAMMER");
                            }
                        }
                    }
                }
                for (int i = 0; i < TeamHacking.Length; i++)
                {
                    if (TeamHacking[i] > 0)
                    {
                        TeamHacking[i]--;
                        if (TeamHacking[i] == 0)
                        {
                            if (i == 0)
                            {
                                Game.RunCommand("MSG RED TEAM DISABLE SUPPLY HACKING");
                            }
                            else
                            {
                                Game.RunCommand("MSG BLUE TEAM DISABLE SUPPLY HACKING");
                            }
                        }
                    }
                }
            }
            if (GameState != 0)
            {
                if (GameState == 1)
                {
                    if (TimeToStart > 0 && TimeToStart < 5)
                    {
                        GlobalGame.PlaySound("TimerTick", new Vector2(0, 600), 1.0f);
                        Game.ShowPopupMessage("Starting in: " + TimeToStart.ToString(), Color.Red);
                    }
                    else if (TimeToStart == 0)
                    {
                        GlobalGame.PlaySound("TimerTick", new Vector2(0, 600), 1.0f);
                        Game.ShowPopupMessage("Starting now!", Color.Red);
                    }
                    else
                    {
                        Game.ShowPopupMessage("Starting in: " + TimeToStart.ToString(), Color.Yellow);
                    }
                }
                else if (!IsDebug)
                {
                    Game.ShowPopupMessage("Time: " + TimeToStart.ToString(), Color.White);
                    if (TimeToStart == 0)
                    {
                        Game.HidePopupMessage();
                    }
                }
            }
        }