private void TryPurchasePlayerShipTemplate() { if (!playerShipTemplate.Unlocked && PlayerController.Player.Balance.Extract(playerShipTemplate.Price)) { //Assign the new ship. ShipyardController.AssignPlayerShip(playerShipTemplate); ///Repurpose the <see cref="button"/> to be used as the "Use" button. button.Text = "Use"; button.SetOnClick(new EventArg1 <PlayerShipTemplate>(ShipyardController.AssignPlayerShip, playerShipTemplate)); } }
private void Load_PlayerShipTemplates() { for (int i = 0; i < PlayerShipTemplates.Templates.Length; i++) { var template = ShipyardController.PlayerShipTemplates.First(t => t.Id == PlayerShipTemplates.Templates[i].Id); if (template != null) { template.Unlocked = PlayerShipTemplates.Templates[i].Unlocked; } } //Assign the new player ship: ShipyardController.AssignPlayerShip(ShipyardController.PlayerShipTemplates.First(t => t.Id == PlayerShipTemplates.CurrentPlayerShipTemplateId)); }