private void MouseHoverOver() { ClickResult clickResult; if (_hoverMouseEvent.TryReceive(out clickResult) && clickResult.Type != ClickType.Empty) { if (clickResult.Type == ClickType.Ground) { var cell = clickResult.ClickedEntity.Get <Cell>(); if (cell != null) { if (!_lastCellHovered.OffsetCoord.Equals(cell.OffsetCoord)) { CellGridState.OnCellDeselected(_lastCellHovered); _lastCellHovered = cell; CellGridState.OnCellSelected(cell); } } } if (clickResult.Type == ClickType.LootCrate) { CellGridState.OnCellDeselected(_lastCellHovered); } } }
private void SelectUnit() { ClickResult clickResult; if (_unitClickedEvent.TryReceive(out clickResult) && clickResult.Type != ClickType.Empty) { var unit = clickResult.ClickedEntity.Get <Unit>(); if (unit != null) { CellGridState.OnUnitClicked(unit); } } }
private void Move() { ClickResult clickResult; if (_moveeEvent.TryReceive(out clickResult) && clickResult.Type != ClickType.Empty) { if (clickResult.Type == ClickType.Ground) { var cell = clickResult.ClickedEntity.Get <Cell>(); if (cell != null) { CellGridState.OnCellClicked(cell); } } } }