Exemplo n.º 1
0
    public Rect GetBoundsForSector(Index2 sIdx)
    {
        float   w = SectorWidthInTiles, h = SectorHeightInTiles;
        Vector3 p = sIdx.ToVector3();

        p.x *= w;
        p.z *= h;
        p   += WorldOffset;
        return(new Rect(p.x, p.z, w, h));
    }
Exemplo n.º 2
0
    protected bool CanOccupyTile_Overworld(Index2 tile)
    {
        if (!WorldInfo.Instance.IsOverworld)
        {
            return(true);
        }

        int  tileCode  = CommonObjects.OverworldTileMap.TryGetTile(tile);
        bool canOccupy = TileMapData.IsTileCodeValid(tileCode) && TileInfo.IsTilePassable(tileCode);

        Vector3 from = transform.position;
        Vector3 to   = tile.ToVector3();

        to.y = from.y;
        DrawDebugLine(from, to, canOccupy);

        return(canOccupy);
    }
Exemplo n.º 3
0
    static public Vector2 TileToPosition_Center(Index2 tile)
    {
        Vector3 p = tile.ToVector3() + WorldInfo.Instance.WorldOffset + TileMap.TileExtents;

        return(new Vector2(p.x, p.z));
    }