public static void AssignPlayerShip(PlayerShipTemplate playerShipTemplate) { playerShipTemplate.Unlocked = true; CurrentPlayerShipTemplate = playerShipTemplate; PlayerController.AssignNewShip(playerShipTemplate.Ship); }
private static void CreatePlayerShipTemplates() { var playerShipTemplateDatas = DataController.LoadAllData <PlayerShipTemplateData>(DataFileType.PlayerShipTemplates, "PlayerShipTemplate"); PlayerShipTemplates = new PlayerShipTemplate[playerShipTemplateDatas.Length]; for (int i = 0; i < playerShipTemplateDatas.Length; i++) { PlayerShipTemplates[i] = new PlayerShipTemplate(playerShipTemplateDatas[i], i == 0 /* Always unlock the first one */); } }
public UIShipTemplate(Transform transform, PlayerShipTemplate playerShipTemplate, Screen screen) : base(transform, playerShipTemplate.Ship.Sprite, screen) { this.playerShipTemplate = playerShipTemplate; if (!playerShipTemplate.Unlocked) { button = AddUIElement(new UIButton( new Transform(new Vector2(0, transform.Height / 2f + 50), new Vector2(transform.Width, 50)), ContentHelper.Arial_Font, "Buy [" + playerShipTemplate.Price + "]", TextAlign.MiddleCenter, 5, ContentHelper.Box4x4_Sprite, new EventArg0(TryPurchasePlayerShipTemplate), screen )); } else { button = AddUIElement(new UIButton( new Transform(new Vector2(0, transform.Height / 2f + 50), new Vector2(transform.Width, 50)), ContentHelper.Arial_Font, "Use", TextAlign.MiddleCenter, 5, ContentHelper.Box4x4_Sprite, new EventArg1 <PlayerShipTemplate>(ShipyardController.AssignPlayerShip, playerShipTemplate), screen )); } button.SetColor(new Color(28, 28, 28)); //Create the stats text, displaying such things as Health and Shield etc.: AddUIElement(new UIText( new Transform(new Vector2(0, transform.Height / 2f + 225), new Vector2(400, 250)), ContentHelper.Arial_Font, string.Format("HP: {0}\nSHD: {1}\nDAM: {2}\nENR: {3}\nREG: {4}", playerShipTemplate.Ship.BaseStats.Health, playerShipTemplate.Ship.BaseStats.Shield, playerShipTemplate.Ship.BaseStats.Damage, playerShipTemplate.Ship.BaseStats.Energy, playerShipTemplate.Ship.BaseStats.EnergyRegen), TextAlign.TopCenter, 5, screen )); }