예제 #1
0
        protected GameObject CreateGameObject(DestroyableTileInfo trigger, DestroyableTileInfo destroyable, Game game, Camera cam)
        {
            Trigger newTrigger = new Trigger(game,
                                            cam,
                                            trigger.Position,
                                            destroyable.Position,
                                            trigger.TileName,
                                            destroyable.TileName);

            return newTrigger;
        }
예제 #2
0
        protected List<DestroyableTileInfo> ExtractGameObjectPositions(Layer layer, string tileName)
        {
            TileArray tileArray = layer.Tiles;
            Size tileSize = layer.TileSize;
            Size amntOfTiles = layer.LayerSize;
            List<DestroyableTileInfo> gameObjectPositions = new List<DestroyableTileInfo>();

            for (int x = 0; x < amntOfTiles.Width; x++)
            {
                for (int y = 0; y < amntOfTiles.Height; y++)
                {
                    Location tileLocation = new Location(x, y);
                    Tile thisTile = tileArray[tileLocation];

                    if (thisTile != null)
                    {
                        DestroyableTileInfo newInfo = new DestroyableTileInfo();

                        newInfo.ID = thisTile.Properties["id"];
                        newInfo.Position = new Point(x * tileSize.Width, y * tileSize.Height);
                        newInfo.TileName = tileName;

                        gameObjectPositions.Add(newInfo);
                    }
                }
            }

            return gameObjectPositions;
        }