public void Init() { Owner.ListPlayer.Clear(); Player NewPlayer = new Player("Player", "Human", true, false, 0, Color.Blue); Owner.ListPlayer.Add(NewPlayer); if (Owner.DicSpawnSquadByPlayer.Count > 0 && Owner.DicSpawnSquadByPlayer["Player"].Count > 0) { int SpawnSquadIndex = 0; for (int S = 0; S < Owner.LayerManager[0].ListSingleplayerSpawns.Count; S++) { if (Owner.LayerManager[0].ListSingleplayerSpawns[S].Tag == "P") { for (int U = 0; U < Owner.DicSpawnSquadByPlayer["Player"][SpawnSquadIndex].UnitsInSquad; ++U) { Owner.DicSpawnSquadByPlayer["Player"][SpawnSquadIndex].At(U).ReinitializeMembers(Owner.DicUnitType[Owner.DicSpawnSquadByPlayer["Player"][SpawnSquadIndex].At(U).UnitTypeName]); } Owner.DicSpawnSquadByPlayer["Player"][SpawnSquadIndex].ReloadSkills(Owner.DicUnitType, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget, Owner.DicManualSkillTarget); Owner.SpawnSquad(0, Owner.DicSpawnSquadByPlayer["Player"][SpawnSquadIndex], 0, Owner.LayerManager[0].ListSingleplayerSpawns[S].Position, 0); ++SpawnSquadIndex; } } } }
public void Init() { for (int P = 0; P < Owner.ListPlayer.Count; P++) { Owner.ListPlayer[P].Color = Owner.ListMultiplayerColor[P]; for (int S = 0; S < Owner.ListPlayer[P].ListSpawnPoint.Count; S++) { if (string.IsNullOrEmpty(Owner.ListPlayer[P].ListSpawnPoint[S].LeaderTypeName)) { continue; } Unit NewLeaderUnit = Unit.FromType(Owner.ListPlayer[P].ListSpawnPoint[S].LeaderTypeName, Owner.ListPlayer[P].ListSpawnPoint[S].LeaderName, Owner.Content, Owner.DicUnitType, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget); Character NewLeaderPilot = new Character(Owner.ListPlayer[P].ListSpawnPoint[S].LeaderPilot, Owner.Content, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget, Owner.DicManualSkillTarget); NewLeaderPilot.Level = 1; NewLeaderUnit.ArrayCharacterActive = new Character[1] { NewLeaderPilot }; Unit NewWingmanAUnit = null; Unit NewWingmanBUnit = null; if (!string.IsNullOrEmpty(Owner.ListPlayer[P].ListSpawnPoint[S].WingmanAName)) { NewWingmanAUnit = Unit.FromType(Owner.ListPlayer[P].ListSpawnPoint[S].WingmanATypeName, Owner.ListPlayer[P].ListSpawnPoint[S].WingmanAName, Owner.Content, Owner.DicUnitType, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget); Character NewWingmanAPilot = new Character(Owner.ListPlayer[P].ListSpawnPoint[S].WingmanAPilot, Owner.Content, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget, Owner.DicManualSkillTarget); NewWingmanAPilot.Level = 1; NewWingmanAUnit.ArrayCharacterActive = new Character[1] { NewWingmanAPilot }; } if (!string.IsNullOrEmpty(Owner.ListPlayer[P].ListSpawnPoint[S].WingmanBName)) { NewWingmanBUnit = Unit.FromType(Owner.ListPlayer[P].ListSpawnPoint[S].WingmanBTypeName, Owner.ListPlayer[P].ListSpawnPoint[S].WingmanBName, Owner.Content, Owner.DicUnitType, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget); Character NewWingmanBPilot = new Character(Owner.ListPlayer[P].ListSpawnPoint[S].WingmanBPilot, Owner.Content, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget, Owner.DicManualSkillTarget); NewWingmanBPilot.Level = 1; NewWingmanBUnit.ArrayCharacterActive = new Character[1] { NewWingmanBPilot }; } Squad NewSquad = new Squad("", NewLeaderUnit, NewWingmanAUnit, NewWingmanBUnit); if (!Owner.ListPlayer[P].IsPlayerControlled) { NewSquad.SquadAI = new DeathmatchScripAIContainer(new DeathmatchAIInfo(Owner, NewSquad)); NewSquad.SquadAI.Load("SRWE Enemy AI"); } else { NewSquad.IsPlayerControlled = true; } Owner.SpawnSquad(P, NewSquad, 0, Owner.ListPlayer[P].ListSpawnPoint[S].Position, 0); } } }
private void SpawnSquad() { if (Map.ListPlayer.Count > SpawnPlayer) { //Don't spawn the unit if there's already on with this ID. for (int U = 0; U < Map.ListPlayer[SpawnPlayer].ListSquad.Count; U++) { if (Map.ListPlayer[SpawnPlayer].ListSquad[U].ID == LeaderToSpawnID) { return; } } } if (LeaderToSpawn != null) { int SpawnPositionX = SpawnPosition.X; int SpawnPositionY = SpawnPosition.Y; Microsoft.Xna.Framework.Vector3 FinalPosition; if (SpawnPositionX >= Map.MapSize.X || SpawnPositionX < 0 || SpawnPositionY >= Map.MapSize.Y || SpawnPositionY >= Map.MapSize.Y) { FinalPosition = new Microsoft.Xna.Framework.Vector3(SpawnPositionX, SpawnPositionY, 0); } else { Map.GetEmptyPosition(new Microsoft.Xna.Framework.Vector3(SpawnPositionX, SpawnPositionY, 0), out FinalPosition); } LeaderToSpawn.Init(); if (WingmanAToSpawn != null) { WingmanAToSpawn.Init(); } if (WingmanBToSpawn != null) { WingmanBToSpawn.Init(); } Squad NewSquad = new Squad("", LeaderToSpawn.SpawnUnit, WingmanAToSpawn == null ? null : WingmanAToSpawn.SpawnUnit, WingmanBToSpawn == null ? null : WingmanBToSpawn.SpawnUnit); NewSquad.IsEventSquad = IsEventSquad; NewSquad.IsPlayerControlled = IsPlayerControlled; NewSquad.SquadDefenseBattleBehavior = DefenseBattleBehavior; if (!string.IsNullOrEmpty(AIPath)) { NewSquad.SquadAI = new DeathmatchScripAIContainer(new DeathmatchAIInfo(Map, NewSquad)); NewSquad.SquadAI.Load(AIPath); } Map.SpawnSquad(SpawnPlayer, NewSquad, LeaderToSpawnID, FinalPosition, SpawnLayer); if (!string.IsNullOrEmpty(PartDropPath)) { NewSquad.ListParthDrop.Add(PartDropPath); } } }
public virtual void Init() { if (Owner.IsOfflineOrServer) { int PlayerIndex = 1; foreach (Player ActivePlayer in Owner.ListPlayer) { if (ActivePlayer.Inventory == null) { continue; } string PlayerTag = PlayerIndex.ToString(); int SpawnSquadIndex = 0; for (int L = 0; L < Owner.LayerManager.ListLayer.Count; L++) { BaseMapLayer ActiveLayer = Owner.LayerManager[L]; for (int S = 0; S < ActiveLayer.ListMultiplayerSpawns.Count; S++) { if (ActiveLayer.ListMultiplayerSpawns[S].Tag == PlayerTag) { if (ActivePlayer.Inventory.ActiveLoadout.ListSquad[SpawnSquadIndex] == null) { ++SpawnSquadIndex; continue; } for (int U = 0; U < ActivePlayer.Inventory.ActiveLoadout.ListSquad[SpawnSquadIndex].UnitsInSquad; ++U) { ActivePlayer.Inventory.ActiveLoadout.ListSquad[SpawnSquadIndex].At(U).ReinitializeMembers(Owner.DicUnitType[ActivePlayer.Inventory.ActiveLoadout.ListSquad[SpawnSquadIndex].At(U).UnitTypeName]); } ActivePlayer.Inventory.ActiveLoadout.ListSquad[SpawnSquadIndex].ReloadSkills(Owner.DicUnitType, Owner.DicRequirement, Owner.DicEffect, Owner.DicAutomaticSkillTarget, Owner.DicManualSkillTarget); Owner.SpawnSquad(PlayerIndex - 1, ActivePlayer.Inventory.ActiveLoadout.ListSquad[SpawnSquadIndex], 0, ActiveLayer.ListMultiplayerSpawns[S].Position, L); ++SpawnSquadIndex; if (SpawnSquadIndex >= ActivePlayer.Inventory.ActiveLoadout.ListSquad.Count) { break; } } } if (SpawnSquadIndex >= ActivePlayer.Inventory.ActiveLoadout.ListSquad.Count) { break; } } ++PlayerIndex; } Owner.CursorPosition = Owner.ListPlayer[0].ListSquad[0].Position; } }
private void SpawnSquad() { if (Map.ListPlayer.Count > SpawnPlayer) { //Don't spawn the unit if there's already on with this ID. for (int U = 0; U < Map.ListPlayer[SpawnPlayer].ListSquad.Count; U++) { if (Map.ListPlayer[SpawnPlayer].ListSquad[U].ID == LeaderToSpawnID) { return; } } } if (LeaderToSpawn != null) { int SpawnPositionX = SpawnPosition.X; int SpawnPositionY = SpawnPosition.Y; Microsoft.Xna.Framework.Vector3 FinalPosition; if (SpawnPositionX >= Map.MapSize.X || SpawnPositionX < 0 || SpawnPositionY >= Map.MapSize.Y || SpawnPositionY >= Map.MapSize.Y) { FinalPosition = new Microsoft.Xna.Framework.Vector3(SpawnPositionX, SpawnPositionY, 0); } else { Map.GetEmptyPosition(new Microsoft.Xna.Framework.Vector3(SpawnPositionX, SpawnPositionY, 0), out FinalPosition); } LeaderToSpawn.Init(); if (WingmanAToSpawn != null) { WingmanAToSpawn.Init(); } if (WingmanBToSpawn != null) { WingmanBToSpawn.Init(); } Squad NewSquad = new Squad("", LeaderToSpawn.SpawnUnit, WingmanAToSpawn == null ? null : WingmanAToSpawn.SpawnUnit, WingmanBToSpawn == null ? null : WingmanBToSpawn.SpawnUnit); NewSquad.IsEventSquad = IsEventSquad; NewSquad.IsPlayerControlled = IsPlayerControlled; NewSquad.SquadDefenseBattleBehavior = DefenseBattleBehavior; if (!string.IsNullOrEmpty(AIPath)) { NewSquad.SquadAI = new DeathmatchScripAIContainer(new DeathmatchAIInfo(Map, NewSquad)); NewSquad.SquadAI.Load(AIPath); } Map.SpawnSquad(SpawnPlayer, NewSquad, LeaderToSpawnID, FinalPosition); if (!string.IsNullOrEmpty(PartDropPath)) { string[] PartByType = PartDropPath.Split('/'); if (PartByType[0] == "Standard Parts") { SystemList.ListPart.Add(PartDropPath, new UnitStandardPart("Content/Units/" + PartDropPath + ".pep", Map.DicRequirement, Map.DicEffect)); } else if (PartByType[0] == "Consumable Parts") { SystemList.ListPart.Add(PartDropPath, new UnitConsumablePart("Content/Units/" + PartDropPath + ".pep", Map.DicRequirement, Map.DicEffect)); } } } }