// Cool down room if on call public void UseCoolant() { // If room 'canheatup' bool is true if (RoomToCoolDown.CanHeatUp) { if ((CoolantLevel - Constants.COOLANT_EMIT_PER_TICK) >= 0) // If current coolant is more than the coolant per tick... { CoolantLevel -= Constants.COOLANT_EMIT_PER_TICK; // Reduce by coolant & temp per tick RoomToCoolDown.DecreaseRoomTemp(Constants.COOLANT_EMIT_PER_TICK); } else if (CoolantLevel > 0) // If coolant level is not empty... { RoomToCoolDown.DecreaseRoomTemp(CoolantLevel); CoolantLevel -= CoolantLevel; // Reduce coolant and temp by remaining coolant } else { CurrentFireEngineStatus = FireEngineStatus.FREE; // Engine has no water. Set status to FREE breaks out of loop Console.WriteLine("Engine out of water!"); } } }
// Station the engine for refueling public void StationEngine() { CurrentFireEngineStatus = FireEngineStatus.STATIONED; Console.WriteLine("\nStationed Engine"); }
// Assign room and fire engine state via room identified in command public void SendEngineToRoom(Room coolingRoom) { RoomToCoolDown = coolingRoom; CurrentFireEngineStatus = FireEngineStatus.ONCALL; Console.WriteLine("\nSending the boys out to room " + RoomToCoolDown.RoomNumber); }
// Constructor for fire engine public FireEngine(int engineID) { EngineID = engineID; // Initialize the engine ID CoolantLevel = Constants.COOLANT_CAPACITY; // Initialize the coolant level CurrentFireEngineStatus = FireEngineStatus.STATIONED; // Initialize the fire engine status as STATIONED }