Пример #1
0
 void SelectObjective()
 {
     if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.D))
     {
         if (objectiveIndex >= interactableObjectives.Count - 1)
         {
             objectiveIndex = 0;
         }
         else
         {
             objectiveIndex++;
         }
         PlayerCursor.instance.PinPointTile(interactableObjectives[objectiveIndex]);
     }
     else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S))
     {
         if (objectiveIndex <= 0)
         {
             objectiveIndex = interactableObjectives.Count - 1;
         }
         else
         {
             objectiveIndex--;
         }
         PlayerCursor.instance.PinPointTile(interactableObjectives[objectiveIndex]);
     }
     else if (Input.GetKeyDown(KeyCode.Escape))
     {
         ArrivedAtDestination(possibleDestination.GetTileCoordX(), possibleDestination.GetTileCoordY());
         //Map.instance.ReturnTilesToNormal();
     }
 }
Пример #2
0
 public void EstablishNewTile(ClickableTile newTile)
 {
     gameObject.transform.position = new Vector3(newTile.GetTileCoordX(), newTile.GetTileCoordY(), gameObject.transform.position.z);
     newTile.AssignUnit(this);
     originTile = newTile;
     TireUnit();
 }
Пример #3
0
 public void PinPointTile(ClickableTile tile)
 {
     //TeleportCursorToTile(tile.GetTileCoordX(), tile.GetTileCoordY());
     currentPositionX = tile.GetTileCoordX();
     currentPositionY = tile.GetTileCoordY();
     SetCursorPosition();
 }
Пример #4
0
 //Unit has been selected by the cursor
 public void UnitSelected()
 {
     if (propietary == GameManager.instance.activePlayer && unitUsed == false)
     {
         if (GameManager.gameState != GameManager.state.MOVING_UNIT)
         {
             unitSelected = true;
             GameManager.instance.unitSelected = this;
             Map.instance.ActivateMovementArea(originTile.GetTileCoordX(), originTile.GetTileCoordY(), movementPoints);
             GameManager.gameState = GameManager.state.MOVING_UNIT;
         }
         else
         {
             ArrivedAtDestination(originTile.GetTileCoordX(), originTile.GetTileCoordY());
         }
     }
     else
     {
         //TODO: What happens when you select a unit you cannot move (other player's unit or already used unit)
         GameManager.instance.unitSelected = this;
         Map.instance.ActivateAttackArea(originTile.GetTileCoordX(), originTile.GetTileCoordY(), movementPoints, ranged, minAttackRange, maxAttackRange);
         GameManager.gameState = GameManager.state.CHECKING_ENEMY_UNIT;
     }
 }
Пример #5
0
    //Player confirms the movement after the unit has moved and/or attacked
    public void EstablishNewTile()
    {
        ClickableTile newTile = possibleDestination;

        if (unitHasMoved == true && decidedToCapture == false)
        {
            capturePoints = 0;
        }

        gameObject.transform.position = new Vector3(newTile.GetTileCoordX(), newTile.GetTileCoordY(), gameObject.transform.position.z);
        originTile.UnassignUnit();
        newTile.AssignUnit(this);
        originTile = newTile;
        GameManager.instance.unitSelected = null;
        TireUnit();
        Map.instance.ReturnTilesToNormal();
    }
Пример #6
0
 int GetHCost(ClickableTile origin, ClickableTile destination)
 {
     return(Math.Abs(origin.GetTileCoordX() - destination.GetTileCoordX()) + Math.Abs(origin.GetTileCoordY() - destination.GetTileCoordY()));
 }