protected override IEnumerable <GameObject> CreateObjs() { var player = new OrthographicMovingObjectFactory() .CreateMovingObject(Tsx.Create(Path.Combine("Characters", "Gareth.tsx")), _player.Transform.Location, new ZIndex(3)) .Add(new TopDownMovement { Speed = 0.2f }); PlayerLocation.Current = new PlayerLocation { MapName = GetType().Name, Transform = player.World }; yield return(player); var cameraPosition = Transform2.CameraZero; cameraPosition.Center = player.World.Center - new Vector2(800, 450); yield return(Entity .Create("Player Camera", cameraPosition) .Add(new Camera()) .AttachTo(player)); foreach (var tile in new OrthographicTileMapFactory().CreateMap(Tmx.Create(Path.Combine("Maps", "Large.tmx")))) { yield return(tile); } foreach (var mapEvent in MapEventsFactory.Create(Path.Combine("Content", "Maps", "Large.events")).InstantiateEvents()) { yield return(mapEvent); } }
protected override IEnumerable <GameObject> CreateObjs() { var tiles = new OrthographicTileMapFactory().CreateMap(Tmx.Create(_path)); tiles.ForEach(tile => tile.Add(CreateTileMouseActions(tile))); var camera = Entity.Create("Map Editor Camera", Transform2.CameraZero).Add(new Camera()).Add(new MouseDrag { Button = MouseButton.Right }); return(tiles.Concat(new List <GameObject> { camera })); }
protected override IEnumerable <GameObject> CreateObjs() { var player = new OrthographicMovingObjectFactory() .CreateMovingObject(Tsx.Create(Path.Combine("Characters", "Gareth.tsx")), _player.Transform.Location, new ZIndex(3)) .Add(new TopDownMovement { Speed = 0.2f }); PlayerLocation.Current = new PlayerLocation { MapName = GetType().Name, Transform = player.World }; yield return(player); var cameraPosition = Transform2.CameraZero; cameraPosition.Center = player.World.Center - new Vector2(800, 450); yield return(Entity .Create("Player Camera", cameraPosition) .Add(new Camera()) .AttachTo(player)); foreach (var tile in new OrthographicTileMapFactory().CreateMap(Tmx.Create(Path.Combine("Maps", "FireCave.tmx")))) { yield return(tile); } yield return(Entity.Create("Start Battle", new Transform2(new TilePosition(3, 5, 48), new Size2(48 * 3, 10))) .Add(new Collision { IsBlocking = false }) .Add(x => new BoxCollider(x.World)) .Add(new StepTrigger()) .Add(new OnCollision { Action = x => x.IfEquals(player, () => Navigate.To(BattleFactory.Create())) })); foreach (var mapEvent in MapEventsFactory.Create(Path.Combine("Content", "Maps", "FireCave.events")).InstantiateEvents()) { yield return(mapEvent); } }
protected override IEnumerable <GameObject> CreateObjs() { InitTilePanel(); InitEditPanel(); var tiles = new OrthographicTileMapFactory().CreateMap(Tmx.Create(_path)); tiles.ForEach(tile => tile.Add(new HighlightColor { Color = _events.GetTileEvents(new TilePosition(tile.World)).Any() ? Event : NoTint, Offset = 10, MinOpacity = 191, MaxOpacity = 255 }) .Add(CreateTileMouseActions(tile))); _selectedTile = tiles.First(); var camera = Entity.Create("Map Editor Camera", Transform2.CameraZero).Add(new Camera()).Add(new MouseDrag { Button = MouseButton.Right }); return(new List <GameObject> { camera, _tilePanel, _editPanel }.Concat(tiles)); }