Пример #1
0
 public void OnUnitDeath(Unit unit)
 {
     BattleMovement.UntrackEnemyRange(unit);
     BattleMovement.UpdateTrackedTiles();
     OverlaysManager.UpdateTrackedOverlays();
 }
Пример #2
0
    public void HandleInput()
    {
        if (_inputManager.ZoomIn)
        {
            _cameraMover.ZoomIn();
        }

        if (_inputManager.ZoomOut)
        {
            _cameraMover.ZoomOut();
        }

        if (_inputManager.RotateLeft)
        {
            _cameraMover.RotateLeft();
        }

        if (_inputManager.RotateRight)
        {
            _cameraMover.RotateRight();
        }

        if (_inputManager.SelectDown)
        {
            if (_cursor.UnitIsSelected)
            {
                if (_cursor.IsInRangeOfSelectedUnit())
                {
                    _inputManager.InputState = EInputState.ActionMenu;
                    _cursor.enabled          = false;
                    var targetTile = BattleMovementUtils.GetDestinationTile();
                    _cursor.SelectedUnit.Move(targetTile);
                    showUnitActions();
                }
            }
            else if (_cursor.HoveredTile.IsOccupied())
            {
                var  hoveredUnit = _cursor.HoveredTile.Occupier;
                bool isUnitFromTheACtiveGroup = hoveredUnit.Group ==
                                                _battleManager.BattleTurnManager.ActiveGroup;
                if (isUnitFromTheACtiveGroup)
                {
                    _cursor.SelectUnit();
                    //_battleManager.BattleMovement.OnNewTile(_cursor.HoveredTile);
                }
                else
                {
                    _overlaysManager.DisableTemporaryOverlays();
                    _battleMovement.ClearUnitTiles();
                    _battleMovement.TrackEnemyRange(hoveredUnit);
                    _battleMovement.UpdateTrackedTiles();
                    _overlaysManager.UpdateTrackedOverlays();
                }
            }
            else
            {
                _inputManager.InputState = EInputState.GeneralMenu;
                _cursor.enabled          = false;
                showGeneralActions();
            }
        }
        else if (_inputManager.CancelDown)
        {
            if (_cursor.UnitIsSelected)
            {
                BattleMovementUtils.HidePath();
                BattleMovementUtils.ResetPath();

                if (_cursor.HoveredTile != _cursor.SelectedUnit.OccupiedTile)
                {
                    _battleManager.OverlaysManager.DisableTemporaryOverlays();
                }

                _cursor.DeselectUnit();
            }
            else if (_cursor.HoveredTile.IsOccupied())
            {
                var  hoveredUnit = _cursor.HoveredTile.Occupier;
                bool isUnitFromTheACtiveGroup = hoveredUnit.Group ==
                                                _battleManager.BattleTurnManager.ActiveGroup;

                if (!isUnitFromTheACtiveGroup)
                {
                    _battleMovement.UntrackEnemyRange(hoveredUnit);
                    _battleMovement.UpdateTrackedTiles();
                    _overlaysManager.UpdateTrackedOverlays();
                }
            }
        }
    }