private void Start() { grid = this.transform.GetChild(0).gameObject; grid.SetActive(false); this.name = "Tile_" + (int)this.transform.position.x + "_" + (int)this.transform.position.z; TCTool = this.GetComponent <TileColouringTool>(); }
void Update() { if (Input.GetKeyDown(KeyCode.Tab) && GameStateManager.Instance.IsCurrentPlayerAI() == false) { SelectNextAvailableUnit(); } if (Helper.IsOverNonHealthBarUI()) { isMouseOverUI = true; if (AbilityIconScript.IsAnyAbilityHovered == false && SelectedUnit != null && SelectedUnit.GetComponent <UnitMovement>().isMoving == false && QCManager.Instance.PlayerChoosesWhetherToQC == false && GameStateManager.Instance.GameState != GameStates.TargettingState) { PathCreator.Instance.ClearPath(); TileColouringTool.UncolourAllTiles(); } return; } else if (GameStateManager.Instance.GameState != GameStates.TargettingState && (isMouseOverUI && SelectedUnit != null && SelectedUnit.GetComponent <UnitMovement>().isMoving == false && QCManager.Instance.PlayerChoosesWhetherToQC == false && mouseoveredTile != null && TurnManager.Instance.CurrentPhase == TurnPhases.Movement && MovementQuestions.Instance.CanUnitMoveAtAll(SelectedUnit.GetComponent <UnitMovement>()))) { if (GameStateManager.Instance.MatchType == MatchTypes.Online && Player.IsPlayerLocal(TurnManager.Instance.PlayerToMove) == false) { // we are in an Online match and its the other dudes turn, so no point in showing BFS } else { //So we just turned from UI back to the board - time to recolour stuff! isMouseOverUI = false; Pathfinder.Instance.ColourPossibleTiles(SelectedUnit.GetComponent <UnitMovement>(), (SelectedUnit.EnemyList == null) || (SelectedUnit.EnemyList.Count == 0)); } } TileRay(); UnitRay(); DestructibleRay(); TestKiller(); }
protected override void OnUpdate() { if (currentlyUsedAbility == this && (oldMouseoveredTile != MouseManager.Instance.mouseoveredTile)) { TileColouringTool.UncolourAllTiles(); ColourTiles(); } oldMouseoveredTile = MouseManager.Instance.mouseoveredTile; }
public void BaseCancelUse() { CancelUse(); TileColouringTool.UncolourAllTiles(); GameStateManager.Instance.BackToIdle(); currentlyUsedAbility = null; isBeingUsed = false; myEnergy.CurrentEnergy += EnergyCost; Debug.Log("woff"); }
protected void FinishUsing() { if (UsesLeft > 0) { UsesLeft--; } GameStateManager.Instance.BackToIdle(); TileColouringTool.UncolourAllTiles(); AlreadyUsedThisTurn = true; currentlyUsedAbility = null; isBeingUsed = false; }
public void Deselect() { TileColouringTool.UncolourAllTiles(); if (GameStateManager.Instance.IsCurrentPlayerAI() == false) { PlaySelectionSound(); } PathCreator.Instance.ClearPath(); UnitSelector toolUnitSelector = new UnitSelector(); toolUnitSelector.DeselectUnit(); SelectedUnit = null; }
// NOTE - currently THIS is JUST doing NORMAL MOVEMENT. Please do not add special movments (like QC) here in ANY WAY! // ALSO - use THIS instead of SendCommand, if its already in a command, obviously. public void DoMovement(UnitMovement unit) { if (GameStateManager.Instance.IsCurrentPlayerAI()) { GameStateManager.Instance.Animate(); } MovementExecutor METool = new MovementExecutor(unit, PathCreator.Instance.GetMovementPath()); if (unit is UnitFlight) { StartCoroutine(METool.Fly((unit as UnitFlight), PathCreator.Instance.Path[PathCreator.Instance.Path.Count - 1].transform.position)); } else { StartCoroutine(METool.Travel()); } TileColouringTool.UncolourAllTiles(); MovementQuestions.Instance.CheckIfAnyMoreUnitsToMove(); }
void SetNextPhase(bool didAI) { if ((GameStateManager.Instance.IsCurrentPlayerAI() == true && didAI == false) || (GameStateManager.Instance.IsCurrentPlayerAI() == false && didAI == true) || CurrentPhase == TurnPhases.Enemy || GameStateManager.Instance.GameState == GameStates.AnimatingState) { return; } if (CurrentPhase == TurnPhases.Movement) { TileColouringTool.UncolourAllTiles(); PopupTextController.AddPopupText("Next Phase!", PopupTypes.Info); Log.SpawnLog("Shooting phase begins."); PathCreator.Instance.ClearPath(); ShootingPhase(); } else if (CurrentPhase == TurnPhases.Shooting) { PopupTextController.AddPopupText("Next Phase!", PopupTypes.Info); Log.SpawnLog("Attack phase begins."); AttackPhase(); } }
void ColourForSelectedUnit() { TileColouringTool.UncolourAllTiles(); Pathfinder.Instance.ColourPossibleTiles(SelectedUnit.GetComponent <UnitMovement>(), (SelectedUnit.EnemyList == null) || (SelectedUnit.EnemyList.Count == 0)); }
protected override void CancelUse() { TileColouringTool.UncolourAllTiles(); }