private void CreateEntities() { var tiledMap = content.Load <TiledMap>(_settings.MapTile); String[] tiledMapLayers = new[] { TiledImportCollisionLayers.BACK_WALLS, TiledImportCollisionLayers.SIDE_WALLS, TiledImportCollisionLayers.NET }; int[] tiledMapPhysicsLayers = new[] { PhysicsLayers.BACK_WALLS, PhysicsLayers.SIDE_WALLS, PhysicsLayers.NET }; var tiledMapComponent = new Handy.Components.TiledMapComponent(tiledMap, tiledMapLayers, tiledMapPhysicsLayers, true); var entity = new Entity(); entity.name = "Map"; tiledMapComponent.renderLayer = RenderLayers.BACKGROUND; entity.addComponent(tiledMapComponent); addEntity(entity); var gameState = new GameState(); gameState.StateEnum = GameStates.Ready; gameState.Players = new Player.Player[_settings.NumPlayers]; for (var i = 0; i < _settings.NumPlayers; i++) { var playerSettings = _settings.Players[i]; var player = new Player.Player(playerSettings); addEntity(player); gameState.Players[i] = player; } var ball = new Ball.Ball(); addEntity(ball); gameState.Ball = ball; GameStateEntity = new Entity(); GameStateEntity.name = "Game"; GameStateEntity.addComponent(new GameStateComponent(gameState)); GameStateEntity.addComponent(new TimerComponent()); GameStateEntity.addComponent(new HitStopComponent()); var scoreboard = new UICanvas(); scoreboard.name = "scoreboard"; scoreboard.renderLayer = RenderLayers.FOREGROUND; GameStateEntity.addComponent(scoreboard); addEntity(GameStateEntity); // add camera var cam = new Camera(); var cameraShake = new CameraShakeComponent(); CameraEntity.addComponent(cam); CameraEntity.addComponent(cameraShake); CameraEntity.name = "Camera"; addEntity(CameraEntity); }
private void CreateEntities() { var gameState = new PracticeGameState(); gameState.StateEnum = PracticeGameStates.WaitingForPlayersToJoin; // to start we don't have any choosers or players! GameStateEntity = new Entity(); GameStateEntity.name = "PracticeGame"; GameStateEntity.addComponent(new PracticeGameStateComponent(gameState)); addEntity(GameStateEntity); // add camera var cam = new Camera(); var cameraShake = new CameraShakeComponent(); CameraEntity.addComponent(cam); CameraEntity.addComponent(cameraShake); CameraEntity.name = "Camera"; addEntity(CameraEntity); }