Exemplo n.º 1
0
    /* Moves the current focused unit to the given hex, if possible. */
    public void moveCurrentUnit(HexScript hex)
    {
        if (!paused) {
            // Makes sure there is currently a focused unit
            if (focusedUnit != null) {
                // If the hex is in the set of moveable hexes, move to it
                if (hexSet.Contains (hex)) {
                    // cover original vision in fog
                    HexScript prev_hex = Map.map [(int)focusedUnit.getPosition().x] [(int)focusedUnit.getPosition().y];
                    prev_hex.setOccupied(0);
                    //Map.update_fog_cover(prev_hex, focusedUnit.getMovement(), true);

                    focusedUnit.move(hex);
                    hex.setOccupied(focusedUnit.getPlayer());
                    // reveal new vision area
                    if (Map.FOG_OF_WAR) { Map.update_field_of_view(focusedUnit, false); }
                }

                focusedUnit = null;
                updateHexes();
            }
        }
    }