Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        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);
                }
            }
        }
Esempio n. 3
0
        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);
                    }
                }
            }
        }