示例#1
0
        /*
         * Returnes a list with tiles of specified type
         * */
        public List <MapTile> returnTilesOfType(MapTile.Types t)
        {
            List <MapTile> list = new List <MapTile>();

            foreach (MapTile mt in tiles)
            {
                if (mt.type == t)
                {
                    list.Add(mt);
                }
            }

            return(list);
        }
示例#2
0
        /*
         * returns a sprite constructed from the given tile name
         * tile needs to be part of the given texture
         * */
        public SpriteTile returnSpriteFromTile(MapTile.Types tileName, TextureInfo texture)
        {
            //get the location from the dictionary
            Vector2i textureLocation;

            if (!tileLocations.TryGetValue(tileName, out textureLocation))
            {
                //if there was no such tile in the dictionary then set the location to 0,0 as a failsafe
                textureLocation = new Vector2i(1, 0);
            }

            var rand = new Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.RandGenerator();

            //construct the sprite using given texture and knowing the location of the tile in the tilemap
            var sprite = new SpriteTile()
            {
                TextureInfo   = texture
                , TileIndex2D = textureLocation
            };

            return(sprite);
        }