public void OnMouseDown() { /* "Build" this PotentialShipTile. * * Destroys the PotentialShipTile and replaces it with an OpenShipTile. * TODO(Derek): Instead issue a build order, so that construction is not instantaneous. * * Adds the OpenShipTile to the PlayerShipConstruct's tileset and refreshes the Editor's tile availability. */ if (!valid || !ShipTileEditor.main.player_ship.in_placement_mode) { return; } particles.startLifetime = 0f; valid = false; GameObject open_ship_tile_object = Instantiate(MainComponentDict.get().open_ship_tile) as GameObject; OpenShipTile open_ship_tile = open_ship_tile_object.GetComponent <OpenShipTile>(); ShipTile.Coordinates coordinates = ShipTileEditor.main.GetCoordinatesByIndex(editor_index); ShipTileEditor.main.player_ship.AddToConstruction(open_ship_tile, coordinates); ShipTileEditor.main.NeedsRefresh(); // This should set a timed construction job, but for now construction is insantaneous. ShipTileEditor.main.Refresh(); }
void Start() { main = this; }