Example #1
0
    override protected void rightClickPower()
    {
        int   col  = (int)(CMouse.getX() / CTileMap.Instance.getTileWidth());
        int   row  = (int)(CMouse.getY() / CTileMap.Instance.getTileHeight());
        CTile tile = CTileMap.Instance.getTile(col, row);

        if (tile == null)
        {
            return;
        }

        CTile topTile = tile.getNeighbourTile(CTile.Direction.TOP);

        if (tile.getTileType() == CTile.Type.WATER && topTile.getTileType() == CTile.Type.AIR && iceTileCounter < MAX_ICE_TILES)
        {
            CTileMap.Instance.changeTile(tile, CTile.Type.ICE);
            iceTileCounter++;
        }
        else if (tile.getTileType() == CTile.Type.ICE && topTile.getTileType() == CTile.Type.AIR && iceTileCounter > 0)
        {
            CTileMap.Instance.changeTile(tile, CTile.Type.WATER);
            iceTileCounter--;
        }
    }
Example #2
0
    override protected void rightClickPower()
    {
        CTile tile = this.getMouseTile();

        if (tile == null)
        {
            return;
        }

        CTile topTile = tile.getNeighbourTile(CTile.Direction.TOP);

        if (tile.getTileType() == CTile.Type.ARTIFICIAL_EARTH && topTile.getTileType() == CTile.Type.AIR)
        {
            CTileMap.Instance.changeTile(tile, CTile.Type.AIR);
            earthTileCounter--;
        }
    }
Example #3
0
    override protected void leftClickPower()
    {
        CTile tile = this.getMouseTile();

        if (tile == null)
        {
            return;
        }

        CTile bottomTile = tile.getNeighbourTile(CTile.Direction.BOTTOM);

        if (tile.getTileType() == CTile.Type.AIR && (bottomTile.getTileType() == CTile.Type.MUD || bottomTile.getTileType() == CTile.Type.ARTIFICIAL_EARTH) && earthTileCounter < MAX_EARTH_TILES)
        {
            CTileMap.Instance.changeTile(tile, CTile.Type.ARTIFICIAL_EARTH);
            earthTileCounter++;
        }
    }