public bool TryAddTarget(GameObject target, out bool hasFoundAllTargets) { hasFoundAllTargets = false; ISelectionComponent _currentTarget = target.GetComponent <ISelectionComponent>(); if (_currentTarget != null) { _currentTarget.Select(); return(true); } return(false); }
public ISelectionComponent GetSelectionComponentNearPoint(Point p, int buffer) { ISelectionComponent result = null; foreach (var s in _selections) { result = s.GetSelectionAtPoint(p, 2); if (result != null) { break; } } return(result); }
protected override void OnClick(RaycastHit hit) { if (timeManager.IsTimeStepAdvancing) { return; } GameObject selectedObject = hit.collider.gameObject.transform.parent.gameObject; AssertHelper.Assert(selectedObject.name.Contains("hextile"), "Clicked on unexpected gameobject: " + selectedObject.name, this); IHexGridCell clickedTile = selectedObject.GetComponent <MonoHexGridCell>().HexGridCell; if (clickedTile.HasComponent <UnselectableComponent>()) { return; } OnHoverOutline onHoverOutline = hit.collider.gameObject.GetComponent <OnHoverOutline>(); if (onHoverOutline) { lastClicked = hit.collider.gameObject; onHoverOutline.OutlineColor = Color.cyan; } townCanvasController.DisplayedTown = null; ISelectionComponent selectionComponent = clickedTile.GetComponent <ISelectionComponent>(); if (!(selectionComponent is null)) { selectionComponent.Select(); } foreach (ITileSelectSubscriber subscriber in subscribers) { subscriber.OnTileSelect(clickedTile); } }
public OverSelectionState(ISelectionManager selectionManager, ISelectionComponent interior) : base(selectionManager, interior.Parent) { ComponentAtCursorPoint = interior; }
public MovingSelectionState(ISelectionManager selectionManager, ISelectionComponent selectionComponent, Point location) : base(selectionManager, selectionComponent.Parent) { ComponentAtCursorPoint = selectionComponent; _actionStartLocation = location; }
public OverEdgeState(ISelectionManager selectionManager, ISelectionComponent edge) : base(selectionManager, edge.Parent) { ComponentAtCursorPoint = edge; }