public AbstractEntityRenderer(ContentManager content, ExpiringSpatialHashCollisionSystem <Entity> spaitalHash, Entity entity, Point tileSize) { EntityTexture = content.Load <Texture2D>($"TopDownRpg/{entity.SpriteSheet}"); Entity = entity; TileSize = tileSize; Offset = TileSize.ToVector2() / 2; _spaitalHash = spaitalHash; }
public OpenWorldGameMode(ViewportAdapter viewPort, IPossibleMovements possibleMovements, string worldName, EntityManager entityManager, StoryEngine storyEngine, EventHandler clickEvent) : base(clickEvent) { _entityManager = entityManager; EntityRenderersDict = new Dictionary <Entity, AbstractEntityRenderer>(); _possibleMovements = possibleMovements; _content = ContentManagerFactory.RequestContentManager(); RenderList = new List <IRenderable>(); Map = _content.Load <TiledMap>($"TopDownRpg/{worldName}"); var graphics = StaticServiceLocator.GetService <GraphicsDevice>(); _mapRenderer = new FullMapRenderer(graphics); _mapRenderer.SwapMap(Map); _tileSize = new Vector2(Map.TileWidth, Map.TileHeight); _moverManager = new MoverManager(); var collisionSystem = new CompositeAbstractCollisionSystem(_possibleMovements); _expiringSpatialHash = new ExpiringSpatialHashCollisionSystem <Entity>(_possibleMovements); _spatialHashMover = new SpatialHashMoverManager <Entity>(collisionSystem, _expiringSpatialHash); AddPlayer(); var entityController = EntityControllerFactory.AddEntityController(PlayerEntity.Instance, _possibleMovements, _moverManager); var texture = _content.Load <Texture2D>("TopDownRpg/Path"); var endTexture = _content.Load <Texture2D>("TopDownRpg/BluePathEnd"); collisionSystem.AddCollisionSystem(new TiledCollisionSystem(_possibleMovements, Map, "Collision-Layer")); collisionSystem.AddCollisionSystem(_expiringSpatialHash); CollisionSystem = collisionSystem; AddClickController(PlayerEntity.Instance); PathRenderer = new PathRenderer(_moverManager, PlayerEntity.Instance, texture, endTexture, _tileSize.ToPoint(), Map.Width, Map.Height); UpdateList.Add(_expiringSpatialHash); UpdateList.Add(entityController); UpdateList.Add(_spatialHashMover); UpdateList.Add(_moverManager); CameraTracker = CameraTrackerFactory.CreateTracker(viewPort, EntityRenderersDict[PlayerEntity.Instance], Map); UpdateList.Add(CameraTracker); LoadEntities(); var dialogFont = _content.Load <SpriteFont>("dialog"); var settings = StaticServiceLocator.GetService <IControllerSettings>(); DialogBox = new EntityStoryBoxDialog(ScreenSize.Size, dialogFont, settings.GamePadEnabled); GuiManager.AddGuiLayer(DialogBox); storyEngine.LoadWorld(AddEntity, RemoveEntity, CollisionSystem.CheckMovementCollision, worldName); InteractEvent += (sender, args) => { var facingDirection = PlayerEntity.Instance.FacingDirection; var interactTarget = (PlayerEntity.Instance.Position + facingDirection).ToPoint(); Interact(interactTarget); }; AddInteractionController(); CameraController.AddCameraZoomController(CameraTracker, ClickController); CameraController.AddCameraMovementController(CameraTracker, ClickController); }
public ExpiringSpatialHashMovementComplete(ExpiringSpatialHashCollisionSystem <T> expiringSpatialHash, T moving) { _moving = moving; _expiringSpatialHash = expiringSpatialHash; }
public EntityRenderer(ContentManager content, ExpiringSpatialHashCollisionSystem <Entity> spaitalHash, Entity entity, Point tileSize) : base(content, spaitalHash, entity, tileSize) { FrameRectangle = new Rectangle(new Point(), tileSize); }
public PlayerEntityRenderer(ContentManager content, ExpiringSpatialHashCollisionSystem <Entity> spaitalHash, Entity entity, Point tileSize) : base(content, spaitalHash, entity, tileSize) { }
public SpatialHashMoverManager(AbstractCollisionSystem abstractCollisionSystem, ExpiringSpatialHashCollisionSystem <T> spatialHashLayer) { _abstractCollisionSystem = abstractCollisionSystem; _characterList = new List <T>(); _spatialHashLayer = spatialHashLayer; }