private void FinishUnitMove() { BattleMovementUtils.HidePath(); BattleMovementUtils.ResetPath(); _battleManager.OverlaysManager.DisableTemporaryOverlays(); _battleManager.BattleTurnManager.DeactivateUnit(_cursor.SelectedUnit); _cursor.DeselectUnit(); }
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(); }
// Update is called once per frame void Update() { MoveCursor(); if (_hoverOverNewTile) { if (UnitIsSelected) { if (_battleManager.BattleMovement.UnitMoveTiles.Contains(HoveredTile)) { BattleMovementUtils.HidePath(); BattleMovementUtils.AddTile(HoveredTile, SelectedUnit); BattleMovementUtils.ShowPath(); } } else { _battleManager.BattleMovement.OnNewTile(HoveredTile); } _hoverOverNewTile = false; } }
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(); } } } }