Ejemplo n.º 1
0
        public static GameState Generate(GameMeta meta, ITilemapGenerator generator)
        {
            var tilemap = getEmptyTilemap(Constants.Game.World.Radius);

            generator.Fill(tilemap);
            return(getGameStateFromTilemap(meta, tilemap));
        }
Ejemplo n.º 2
0
 public GameState(GameMeta meta, Level level)
 {
     Meta      = meta;
     Level     = level;
     Geometry  = new LevelGeometry(level.Tilemap);
     Navigator = new MultipleSinkNavigationSystem(Geometry);
     Resources = new ResourceManager();
 }
Ejemplo n.º 3
0
        private static GameState getGameStateFromTilemap(GameMeta meta, Tilemap <TileInfo> tilemap)
        {
            var gameState = new GameState(meta, new Level(tilemap));

            gameState.Add(new Base(Footprint.CircleSeven.Positioned(gameState.Level, new Position2())));
            var center = new Tile <TileInfo>(tilemap, 0, 0);

            Directions.All.Enumerate()
            .Select((d) => center.Offset(d.Step() * tilemap.Radius))
            .ForEach((t) => gameState.Add(new UnitSource(t)));

            return(gameState);
        }
Ejemplo n.º 4
0
        public GameCamera(InputManager inputManager, GameMeta meta, float levelRadius)
        {
            this.inputManager = inputManager;
            this.meta         = meta;
            this.levelRadius  = levelRadius;

            cameraPosition = Vector2.Zero;
            cameraDistance = ZDefault;
            recalculateViewMatrix();

            scrollActions = new Dictionary <IAction, Vector2>
            {
                { keyOrAxis(Key.Left, "-x"), -Vector2.UnitX },
                { keyOrAxis(Key.Right, "+x"), Vector2.UnitX },
                { keyOrAxis(Key.Up, "+y"), Vector2.UnitY },
                { keyOrAxis(Key.Down, "-y"), -Vector2.UnitY },
            };

            zoomActions = new Dictionary <IAction, float>
            {
                { keyOrAxis(Key.PageDown, ":+z"), 1f },
                { keyOrAxis(Key.PageUp, "-z"), -1f },
            };
        }
Ejemplo n.º 5
0
        public static GameState Empty(GameMeta meta)
        {
            var tilemap = getEmptyTilemap(Constants.Game.World.Radius);

            return(getGameStateFromTilemap(meta, tilemap));
        }