public AreaRenderer(AreaEntity roomOwner, List<DrawParameters> renderList, Color backgroundColor) { this.roomOwner = roomOwner; this.renderList = renderList; this.backgroundColor = backgroundColor; initialize(); }
public AreaCollisionComponent(AreaEntity owner) { this.owner = owner; this.wrapperList = new List<AreaCollisionBodyWrapper>(); this.propertyWrapperCollection = new Dictionary<int, List<AreaCollisionBodyWrapper>>(); this.initialize(); }
public ParallaxLayer(AreaEntity room, float minimalDistance, List<DrawParameters> items, bool drawOnFront) : base(room) { this.drawOnFront = drawOnFront; this.items = items; this.minimalDistance = minimalDistance; initialize(); }
public AreaRenderer(AreaEntity roomOwner, List<DrawParameters> renderList) { this.roomOwner = roomOwner; this.renderList = renderList; initialize(); }
public TestStage(AreaEntity owner) { this.owner = owner; initialize(); }
public ParallaxLayer(AreaEntity room, List<DrawParameters> items) : base(room) { this.items = items; initialize(); }
/// <summary> /// Cambia inmediatamente de cuarto según la Id del cuarto /// </summary> /// <param name="areaId">Id del cuarto a cambiar</param> public void setArea(string areaId) { if (this.area.ContainsKey(areaId)) { AreaEntity oldArea = this.actualArea; AreaEntity newArea = this.area[areaId]; if (oldArea != null) { oldArea.UnloadContent(); } CollisionManager.Instance.resetState(-GameConstants.ROOM_OUTER_BORDER, -GameConstants.ROOM_OUTER_BORDER, (newArea.WidthBlocks * GameConstants.BLOCK_SIZE) + GameConstants.ROOM_OUTER_BORDER * 2, (newArea.HeightBlocks * GameConstants.BLOCK_SIZE) + GameConstants.ROOM_OUTER_BORDER * 2); float cameraLimitX1 = 0; float cameraLimitY1 = 0; float cameraLimitX2 = 0; float cameraLimitY2 = 0; newArea.getCameraLimits(ref cameraLimitX1, ref cameraLimitY1, ref cameraLimitX2, ref cameraLimitY2); Program.GAME.Camera.setLimits(cameraLimitX1, cameraLimitY1, cameraLimitX2, cameraLimitY2); newArea.LoadContent(); this.actualArea = newArea; Vector2 newEntityPosition = new Vector2(567,341); // Esto quizas lo cambie luego, reposicionar la entidad y cámara según las coordenadas de salida de la puerta. List<AbstractCollisionComponent> mainEntityCollisionComponentList = mainEntity.findByBaseClass<AbstractCollisionComponent>(); if (mainEntityCollisionComponentList.Count > 0) { mainEntityCollisionComponentList[0].move( mainEntity.getVectorProperty(EntityProperty.Position), newEntityPosition); } mainEntity.changeVectorProperty(EntityProperty.Position, newEntityPosition, false); Program.GAME.Camera.resetCameraPosition(); } else { // En caso de que se intente salir por una puerta que no existe. throw new InvalidOperationException("El cuarto con el ID " + areaId + " no se encuentra registrado."); } }
/// <summary> /// Agrega un cuarto a la lista global de cuartos. /// </summary> /// <param name="room">Entidad a agregar.</param> public void addArea(AreaEntity room) { this.area.Add(room.Id, room); }