public void Update(float elapsedSeconds) { for (int i = 0; i < entities.Count; i++) { CollidableEntity entity = this.entities[i]; entity.Update(elapsedSeconds); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); _graphicsWorker.Initialize(); /*AEntity bloc = new Blob(new Vector3(0, 0, 5), Vector3.Zero, 1f, GraphicsDevice); * bloc = ComponentFactory.AddCollision(bloc, 1, 1, 1); * GameDatas.Entities.Add(bloc); * * AEntity mainPlayer = new Player(Vector3.Zero, Vector3.Zero, 1f, GraphicsDevice); * mainPlayer = ComponentFactory.AddCollision(mainPlayer, 1, 1, 1); * mainPlayer = ComponentFactory.AddMovement(mainPlayer, 0.05f, 0.05f); * GameDatas.Entities.Add(mainPlayer); * * AEntity bloc2 = new Blob(new Vector3(0, 0, -5), Vector3.Zero, 1f, GraphicsDevice); * bloc2 = ComponentFactory.AddCollision(bloc2, 1, 1, 1); * GameDatas.Entities.Add(bloc2);*/ AEntity bloc1 = new CollidableEntity(new Block(new Vector3(0, 0, 5), Vector3.Zero, 1, 1, 1, 1, GraphicsDevice), 1, 1, 1); GameDatas.Entities.Add(bloc1); AEntity mainPlayer = new Player(new Block(new Vector3(0, 0, 0), Vector3.Zero, 1, 1, 1, 1, GraphicsDevice), 1, 1, 1, new Vector3(0.05f), new Vector3(1f)); GameDatas.Entities.Add(mainPlayer); AEntity bloc2 = new CollidableEntity(new Block(new Vector3(0, 0, -5), Vector3.Zero, 1, 1, 1, 1, GraphicsDevice), 1, 1, 1); GameDatas.Entities.Add(bloc2); GameDatas.MainCamera = new FPSCamera(GraphicsDevice, mainPlayer); AddInputProcessor(new PlayerController((MoveableEntity)mainPlayer)); AddInputProcessor(new FPSCameraController(GameDatas.MainCamera)); //new Labyrinthe.World.World(); }
public void AddTo(CollidableEntity entity) { this.Entity = entity; entity.Add(this); }
public void Remove(CollidableEntity entity) { this.entities.Remove(entity); }
public void Add(CollidableEntity entity) { this.entities.Add(entity); }