Beispiel #1
0
    void LinkSkyToLand()
    {
        for (int x = 0; x < AtlasX; x++)
        {
            for (int y = 0; y < AtlasY; y++)
            {
                int skyX = x / SkySizeFactor;
                int skyY = y / SkySizeFactor;

                LandMap.GetTile(x, y).AddLink(SkyMap.GetTile(skyX, skyY));
            }
        }
    }
Beispiel #2
0
    private void OnSceneGUI()
    {
        //if (Event.current.type == EventType.Repaint)

        Vector3 Position = ((UrbMap)target).transform.position;

        {
            Handles.color = ((UrbMap)target).Color;

            float width  = ((UrbMap)target).TileSize * ((UrbMap)target).Xsize;
            float height = ((UrbMap)target).TileSize * ((UrbMap)target).Ysize;



            Rect MapRect = new Rect(Position, new Vector2(width, height));
            Handles.DrawSolidRectangleWithOutline(MapRect, Color.clear, ((UrbMap)target).Color);
        }

        if (((UrbMap)target).DebugDisplay)
        {
            UrbMap DisplayMap = (UrbMap)target;

            for (int x = 0; x < DisplayMap.Xsize; x++)
            {
                for (int y = 0; y < DisplayMap.Ysize; y++)
                {
                    UrbTile Tile = DisplayMap.GetTile(x, y);
                    if (Tile == null)
                    {
                        continue;
                    }

                    UrbTile[] LinkedTiles = Tile.GetLinked();

                    for (int l = 0; l < LinkedTiles.Length; l++)
                    {
                        if (LinkedTiles[l] == null)
                        {
                            continue;
                        }
                        Handles.color = Color.yellow;
                        Handles.DrawLine(Tile.Location, LinkedTiles[l].Location);
                    }
                }
            }
        }
    }
Beispiel #3
0
    public bool LoadTileFromData(UrbTileData input)
    {
        LinksDirty = true;
        if (input.Links.Length > 0)
        {
            Links = new UrbTile[input.Links.Length];

            for (int i = 0; i < Links.Length; i++)
            {
                UrbMap LinkedMap = UrbSystemIO.GetMapFromID(input.Links[i].MapID);
                if (LinkedMap != null)
                {
                    UrbTile LinkedTile = LinkedMap.GetTile(input.Links[i].X, input.Links[i].Y);
                    Links[i] = LinkedTile;
                }
            }
        }
        else
        {
            Links = new UrbTile[0];
        }

        ClearTile();

        if (input.Contents != null && input.Contents.Length > 0)
        {
            for (int c = 0; c < input.Contents.Length; c++)
            {
                UrbSystemIO.LoadAgentFromID(input.Contents[c], this, input.Objects[c]);
            }
        }

        Blocked = input.Blocked;
        Environment.LoadEnvironmentFromData(input.Environment);
        // This is broken somehow, fix it.

        /*TerrainTypes = new UrbPathTerrain[input.TerrainTypes.Length];
         *
         * for (int i = 0; i < TerrainTypes.Length; i++)
         * {
         *  TerrainTypes[i] = input.TerrainTypes[i];
         * }*/
        return(true);
    }