public static Vector2 GetRandomWorldPoint() { Area area = GlobalGame.GetCameraArea(); return(new Vector2(GlobalRandom.Next((int)area.Left, (int)area.Right), GlobalRandom.Next((int)area.Bottom, (int)area.Top))); }
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); }
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); }
public void ContinueMineStrike() { Stage++; int continuing = 70; int bulletPer = 10; if (Stage % bulletPer == 0) { Area area = GlobalGame.GetCameraArea(); Vector2 newPos = new Vector2(GlobalRandom.Next((int)area.Left, (int)area.Right), WorldTop); GlobalGame.CreateObject("WpnMineThrown", newPos); } if (Stage >= continuing) { MinusAmmo(); } }
public void ContinueArtilleryStrike() { Stage++; int continuing = 100; int bulletPer = 10; if (Stage % bulletPer == 0) { Area area = GlobalGame.GetCameraArea(); Vector2 newPos = new Vector2(GlobalRandom.Next((int)area.Left, (int)area.Right), WorldTop); GlobalGame.SpawnProjectile(ProjectileItem.GRENADE_LAUNCHER, newPos, new Vector2(0, -1)); } if (Stage >= continuing) { MinusAmmo(); } }
public void CallReinforcement(TPlayer player) { Area area = GlobalGame.GetCameraArea(); for (int i = 0; i < PlayerList.Count; i++) { TPlayer pl = PlayerList[i]; if (pl != null && pl.IsActive() && pl != player && pl.Team == player.Team && !pl.IsAlive()) { float x = GlobalRandom.Next((int)(area.Left + area.Width / 5), (int)(area.Right - area.Width / 5)); float y = WorldTop + 50; IObject crate = GlobalGame.CreateObject("SupplyCrate00", new Vector2(x, y)); IObject platf = GlobalGame.CreateObject("Lift00A", new Vector2(x, y - 10)); IObject leftBorder = GlobalGame.CreateObject("Lift00A", new Vector2(x - 10, y), (float)Math.PI / -2); IObject rightBorder = GlobalGame.CreateObject("Lift00A", new Vector2(x + 10, y), (float)Math.PI / 2); leftBorder.SetBodyType(BodyType.Dynamic); rightBorder.SetBodyType(BodyType.Dynamic); IObjectDestroyTargets destroy = (IObjectDestroyTargets)GlobalGame.CreateObject("DestroyTargets", new Vector2(x, y)); platf.SetMass(1e-3f); leftBorder.SetMass(1e-3f); rightBorder.SetMass(1e-3f); IObjectWeldJoint joint = (IObjectWeldJoint)GlobalGame.CreateObject("WeldJoint", new Vector2(x, y)); joint.AddTargetObject(crate); joint.AddTargetObject(platf); joint.AddTargetObject(rightBorder); joint.AddTargetObject(leftBorder); destroy.AddTriggerDestroyObject(crate); destroy.AddObjectToDestroy(joint); destroy.AddObjectToDestroy(platf); destroy.AddObjectToDestroy(leftBorder); destroy.AddObjectToDestroy(rightBorder); ObjectsToRemove.Add(destroy); ObjectsToRemove.Add(platf); ObjectsToRemove.Add(joint); ObjectsToRemove.Add(leftBorder); ObjectsToRemove.Add(rightBorder); pl.Equipment.Clear(); pl.Armor.SetId(0); pl.Revive(100, false, true, x, y); player.AddExp(5, 5); } } }
public int Update() { int blue = 0, red = 0; if (GlobalGame.GetCameraArea().Left == CameraPosition.X && GlobalGame.GetCameraArea().Top == CameraPosition.Y && !_PlayersHaveSpawned) { for (int i = 0; i < PlayerList.Count; i++) { var player = PlayerList[i]; var menu = PlayerMenuList.Where(m => m.Player != null && m.Player.Name != null && m.Player.Name.Equals(player.Name)).FirstOrDefault(); if (menu == null) { DebugLogger.DebugOnlyDialogLog("PLAYER " + menu.Player.Name + " CAN'T BE SPAWNED BECAUSE HE HAS NO MENU ASSIGNED"); continue; } if (player.Team == PlayerTeam.Team1) { menu.SpawnPlayer(BlueSpawnPosition[blue].GetWorldPosition()); DebugLogger.DebugOnlyDialogLog("PLAYER " + menu.Player.Name + " SPAWNED AT BLUE POSITION NUMBER " + blue); blue++; } else { menu.SpawnPlayer(RedSpawnPosition[red].GetWorldPosition()); DebugLogger.DebugOnlyDialogLog("PLAYER " + menu.Player.Name + " SPAWNED AT RED POSITION NUMBER " + blue); red++; } } for (int i = 0; i < PlayerList.Count; i++) { PlayerList[i].Start(); } _PlayersHaveSpawned = true; } //if (_PlayersHaveSpawned) //{ // var activeUsers = Game.GetActiveUsers(); // for (int i = 0; i < activeUsers.Length; i++) // { // var u = activeUsers[i]; // if (u != null && u.GetPlayer() != null) // { // var body = u.GetPlayer(); // if (body.GetWorldPosition().Y > WorldTop) // { // DebugLogger.DebugOnlyDialogLog("PLAYER " + u.Name + " DIDN'T SPAWNED CORRECTLY. TELEPORTING THEM"); // var menu = PlayerMenuList.Where(m => m.Player != null && m.Player.Name != null && m.Player.Name.Equals(u.Name)).FirstOrDefault(); // var player = PlayerList.Where(p => p.Name != null && p.Name.Equals(u.Name)).FirstOrDefault(); // if (player != null) // { // DebugLogger.DebugOnlyDialogLog("PLAYER " + player.Name + " EXISTS IN PlayerList"); // } // else // { // DebugLogger.DebugOnlyDialogLog("PLAYER " + player.Name + " DOESN'T EXIST IN PlayerList"); // } // DebugLogger.DebugOnlyDialogLog("PLAYER " + u.Name + " DIDN'T SPAWNED CORRECTLY. TELEPORTING THEM"); // if (menu == null) // { // DebugLogger.DebugOnlyDialogLog("PLAYER " + player.Name + " DOESN'T HAVE AN ASSIGNED MENU. HIS PROGRESS WILL BE LOST"); // switch (body.GetTeam()) // { // case PlayerTeam.Team1: // body.SetWorldPosition(BlueSpawnPosition[0].GetWorldPosition()); // break; // case PlayerTeam.Team2: // body.SetWorldPosition(RedSpawnPosition[0].GetWorldPosition()); // break; // case PlayerTeam.Team3: // DebugLogger.DebugOnlyDialogLog("BODY WAS FROM GREEN TEAM."); // break; // } // } // else // { // DebugLogger.DebugOnlyDialogLog("PLAYER " + player.Name + " HAS AN ASSIGNED MENU. USING MENU TO SPAWN HIM"); // switch (body.GetTeam()) // { // case PlayerTeam.Team1: // DebugLogger.DebugOnlyDialogLog("BODY WAS FROM BLUE TEAM."); // menu.SpawnPlayer(BlueSpawnPosition[0].GetWorldPosition()); // break; // case PlayerTeam.Team2: // DebugLogger.DebugOnlyDialogLog("BODY WAS FROM RED TEAM."); // menu.SpawnPlayer(RedSpawnPosition[0].GetWorldPosition()); // break; // case PlayerTeam.Team3: // DebugLogger.DebugOnlyDialogLog("BODY WAS FROM GREEN TEAM."); // break; // } // } // } // } // } //} if (CapturedBy != 0) { return(0); } bool blueWin = true; bool redWin = true; for (int i = 0; i < PointList.Count; i++) { PointList[i].Update(); if (PointList[i].CaptureProgress != MaxCapturePointProgress) { blueWin = false; } if (PointList[i].CaptureProgress != -MaxCapturePointProgress) { redWin = false; } } if (blueWin) { CapturedBy = 1; return(1); } else if (redWin) { CapturedBy = 2; return(2); } return(0); }