Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 protected override void OnUpdate()
 {
     if (currentlyUsedAbility == this && (oldMouseoveredTile != MouseManager.Instance.mouseoveredTile))
     {
         TileColouringTool.UncolourAllTiles();
         ColourTiles();
     }
     oldMouseoveredTile = MouseManager.Instance.mouseoveredTile;
 }
Esempio n. 3
0
 public void BaseCancelUse()
 {
     CancelUse();
     TileColouringTool.UncolourAllTiles();
     GameStateManager.Instance.BackToIdle();
     currentlyUsedAbility    = null;
     isBeingUsed             = false;
     myEnergy.CurrentEnergy += EnergyCost;
     Debug.Log("woff");
 }
Esempio n. 4
0
 protected void FinishUsing()
 {
     if (UsesLeft > 0)
     {
         UsesLeft--;
     }
     GameStateManager.Instance.BackToIdle();
     TileColouringTool.UncolourAllTiles();
     AlreadyUsedThisTurn  = true;
     currentlyUsedAbility = null;
     isBeingUsed          = false;
 }
Esempio n. 5
0
    public void Deselect()
    {
        TileColouringTool.UncolourAllTiles();
        if (GameStateManager.Instance.IsCurrentPlayerAI() == false)
        {
            PlaySelectionSound();
        }
        PathCreator.Instance.ClearPath();
        UnitSelector toolUnitSelector = new UnitSelector();

        toolUnitSelector.DeselectUnit();
        SelectedUnit = null;
    }
Esempio n. 6
0
    // 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();
    }
Esempio n. 7
0
 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();
     }
 }
Esempio n. 8
0
 void ColourForSelectedUnit()
 {
     TileColouringTool.UncolourAllTiles();
     Pathfinder.Instance.ColourPossibleTiles(SelectedUnit.GetComponent <UnitMovement>(), (SelectedUnit.EnemyList == null) || (SelectedUnit.EnemyList.Count == 0));
 }
Esempio n. 9
0
 protected override void CancelUse()
 {
     TileColouringTool.UncolourAllTiles();
 }