public ISelectable GetSelectableInPos(ApartmentBuilderGrid grid, Vector2 position, out Room inRoom) { ISelectable selectable = null; inRoom = null; var rad = SkinManager.Instance.CurrentSkin.CirclesRad; foreach (var room in _Rooms) { foreach (var wallObject in room.WallObjects) { if (!(Vector2.Distance(wallObject.GetVector2Position(), position) < rad)) { continue; } inRoom = room; return(wallObject); } foreach (var roomVert in room.Contour) { if (!(Vector2.Distance(roomVert.Position, position) < rad)) { continue; } inRoom = room; selectable = roomVert; } } return(selectable); }
public void DrawSelection(ApartmentBuilderGrid grid, Color color) { var position = GetVector2Position(); Handles.color = color; WindowObjectDrawer.DrawCircle(position); WindowObjectDrawer.DrawLabel(position, position.RoundCoordsToInt().ToString()); }
public void DrawSelection(ApartmentBuilderGrid grid, Color color) { Handles.color = color; for (int i = 0, count = _Contour.Count; i < count; i++) { var p1 = _Contour[i].Position; var p2 = _Contour[(i + 1) % count].Position; Handles.color = color; WindowObjectDrawer.DrawLine(p1, p2); } }
private void OnEnable() { Grid = new ApartmentBuilderGrid(this); _Toolbar = new Toolbar(this); WindowObjectDrawer.CurrentWindow = this; _States = new Dictionary <EditorWindowState, StateApartmentBuilder> { { EditorWindowState.Normal, new NormalState(this) }, { EditorWindowState.RoomCreation, new CreatingRoomState(this) }, { EditorWindowState.ObjectAdding, new AddObjectState(this) } }; ActivateState(EditorWindowState.Normal); wantsMouseMove = true; }