//SHIP CREATION private static void SpawnAllShips() { foreach (var squadList in SquadBuilder.SquadLists) { SquadBuilder.SetPlayerSquadFromImportedJson(squadList.Name, squadList.SavedConfiguration, squadList.PlayerNo, delegate { }); if (Roster.GetPlayer(squadList.PlayerNo).GetType() != typeof(HotacAiPlayer)) { JSONObject playerInfo = squadList.SavedConfiguration.GetField("PlayerInfo"); Roster.GetPlayer(squadList.PlayerNo).NickName = playerInfo.GetField("NickName").str; Roster.GetPlayer(squadList.PlayerNo).Title = playerInfo.GetField("Title").str; Roster.GetPlayer(squadList.PlayerNo).Avatar = playerInfo.GetField("Avatar").str; } Roster.GetPlayer(squadList.PlayerNo).SquadCost = squadList.Points; } // Keep order, ships must have same ID on both clients ShipFactory.Initialize(); foreach (SquadBuilderShip shipConfig in SquadBuilder.GetSquadList(PlayerNo.Player1).GetShips()) { GenericShip newShip = ShipFactory.SpawnShip(shipConfig); AddShipToLists(newShip); } foreach (SquadBuilderShip shipConfig in SquadBuilder.GetSquadList(PlayerNo.Player2).GetShips()) { GenericShip newShip = ShipFactory.SpawnShip(shipConfig); AddShipToLists(newShip); } BoardTools.Board.SetShips(); }
public static void GeneratePlayersShipConfigurations() { ShipFactory.Initialize(); Global.RemoveAllShips(); foreach (var ship in SquadBuilderRoster.GetShips()) { ship.Ship.SkinName = GetSkinName(ship); Global.AddShip(ship.Ship, ship.Player, GetShipCostCalculated(ship)); } }
public void StartBattle() { if (SquadBuilder.ValidateCurrentPlayersRoster()) { SquadBuilder.SaveSquadConfigurations(); ShipFactory.Initialize(); if (!SquadBuilder.IsNetworkGame) { SquadBuilder.StartLocalGame(); } else { ChangePanel("MultiplayerDecisionPanel"); } } }
//SHIP CREATION private static void SpawnAllShips() { ObstaclesManager.Instance.ChosenObstacles = new List <GenericObstacle>(); foreach (var squadList in SquadBuilder.SquadLists) { SquadBuilder.SetPlayerSquadFromImportedJson(squadList.Name, squadList.SavedConfiguration, squadList.PlayerNo, delegate { }); if (Roster.GetPlayer(squadList.PlayerNo).PlayerType != PlayerType.Ai) { JSONObject playerInfo = squadList.SavedConfiguration.GetField("PlayerInfo"); Roster.GetPlayer(squadList.PlayerNo).NickName = playerInfo.GetField("NickName").str; Roster.GetPlayer(squadList.PlayerNo).Title = playerInfo.GetField("Title").str; Roster.GetPlayer(squadList.PlayerNo).Avatar = playerInfo.GetField("Avatar").str; } Roster.GetPlayer(squadList.PlayerNo).SquadCost = squadList.Points; Roster.GetPlayer(squadList.PlayerNo).ChosenObstacles = new List <GenericObstacle>() { ObstaclesManager.GenerateObstacle(squadList.ChosenObstacles[0].ShortName, squadList.PlayerNo), ObstaclesManager.GenerateObstacle(squadList.ChosenObstacles[1].ShortName, squadList.PlayerNo), ObstaclesManager.GenerateObstacle(squadList.ChosenObstacles[2].ShortName, squadList.PlayerNo) }; } // Keep order, ships must have same ID on both clients ShipFactory.Initialize(); foreach (SquadBuilderShip shipConfig in SquadBuilder.GetSquadList(PlayerNo.Player1).GetShips()) { GenericShip newShip = ShipFactory.SpawnShip(shipConfig); AddShipToLists(newShip); } foreach (SquadBuilderShip shipConfig in SquadBuilder.GetSquadList(PlayerNo.Player2).GetShips()) { GenericShip newShip = ShipFactory.SpawnShip(shipConfig); AddShipToLists(newShip); } BoardTools.Board.SetShips(); }