Exemplo n.º 1
0
    public void PlaceUnit(RUnit unit)
    {
        int[]        coords      = gameController.ConvertStringToArray(unit.coords, 2);
        RArmySpawner armySpawner = unit.allegiance == Mark.CON ? CONArmySpawner : USArmySpawner;
        Vector3      location    = new Vector3(coords [0] + 0.5f, 0.05f, coords [1] + 0.5f);

        armySpawner.InstantiatePrefab(location, unit);
    }
Exemplo n.º 2
0
    void SelectThisUnit()
    {
        RUnit squareDictionaryRunit = gameController.game.squareDictionary [coords].unitOccupyingSquare;

        board.DeselectPiece();          //deslect the original piece, hide the movement squares etc.
        InstantiateUnitMount();         //create the spinning gold circle that shows what unit is selected

        //select the unit in gameController
        gameController.selectedUnit       = squareDictionaryRunit;
        gameController.unitSelected       = true;
        gameController.selectedGameObject = this.gameObject;

        //update the unit HUD and show it
        uiController.SetUnitHUDValues(squareDictionaryRunit);
        uiController.ShowHUD(uiController.UnitHUD);

        //If the unit has a move left, show possible squares, if not flash red on the unitHUD number of moves.
        if (numMoves > 0)
        {
            int[] intCoords = gameController.ConvertStringToArray(squareDictionaryRunit.coords, 2);
            board.ShowPossibleSquares(intCoords, squareDictionaryRunit);
        }
        else
        {
            StartCoroutine(uiController.MakeTextFlashRed(uiController.unitHUDMoves));
            Debug.Log("You don't have enough moves left for this piece");
        }
    }