void EnableModulesForSeat(ShipSeat seat) { if (seat.role == ShipSeatRole.pilot && seat.controlledModules.Count < 1) // if pilot has no pilot module { Debug.LogWarning("Attempting to pilot ship without a pilot module"); // !!! TODO error handling here? instantiate a module? } SetModuleEnabledStaes(seat.controlledModules, true); }
void InitializeSeatModules(ShipSeat seat) { for (int i = seat.controlledModules.Count - 1; i >= 0; i--) { if (seat.controlledModules[i] == null) { seat.controlledModules.RemoveAt(i); } seat.controlledModules[i].InitializeModule(this); } }
// !!! TODO different handling for controlled players vs uncontrolled void Embark(Character character) { ShipSeat playerSeat = HighestPriorityAvailableSeat; playerSeat.occupant = character; shipController.enabled = true; EnableModulesForSeat(playerSeat); character.ToggleControl(); availableSeats--; }
void DisableModulesForSeat(ShipSeat seat) { SetModuleEnabledStaes(seat.controlledModules, false); }