public override bool KeyPressed() { switch (KeyCode) { case Enums.KeyCodes.Digit1: case Enums.KeyCodes.NumPad1: _roomType = typeof(Office); if (!(_hoverRoom is Office)) { _hoverRoom = new Office(this, Vector2.Zero); } break; case Enums.KeyCodes.Digit2: case Enums.KeyCodes.NumPad2: _roomType = typeof(PrivateOffice); if (!(_hoverRoom is PrivateOffice)) { _hoverRoom = new PrivateOffice(this, Vector2.Zero); } break; default: break; } return(true); // Event prevent default }
private bool Hire(Room room, Vector2 hirePosition) { if (room is null) { return(false); } hirePosition += new Vector2(UNIT_SCALE / 2f, UNIT_SCALE / 2f); return(room switch { Office office => office.Hire(new Worker(this, hirePosition)), PrivateOffice privateOffice => privateOffice.Hire(new Supervisor(this, hirePosition)), _ => throw new NotImplementedException($"Room of type {room.GetType()} not yet implemented"), });