Example #1
0
 private void FinishUnitMove()
 {
     BattleMovementUtils.HidePath();
     BattleMovementUtils.ResetPath();
     _battleManager.OverlaysManager.DisableTemporaryOverlays();
     _battleManager.BattleTurnManager.DeactivateUnit(_cursor.SelectedUnit);
     _cursor.DeselectUnit();
 }
Example #2
0
    public void ExecuteUnitMove()
    {
        _cursor.Hide();

        SetCameraOn(_cursor.SelectedUnit.gameObject);

        BattleMovementUtils.HidePath();
        _battleManager.OverlaysManager.DisableTemporaryOverlays();

        _cursor.SelectedUnit.StartMoveCoroutine(new LinkedList <Tile>(BattleMovementUtils.Path));

        WaitForMovingUnit(_cursor.SelectedUnit);
        BattleMovementUtils.ResetPath();
    }
Example #3
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();
                }
            }
        }
    }