public void ReplaceTilePosition(GamePlatformer.Model.Utils.TilePosition newTilePosition) { var index = GameComponentsLookup.TilePosition; var component = CreateComponent <GamePlatformer.Model.GameComponents.TilePositionComponent>(index); component.tilePosition = newTilePosition; ReplaceComponent(index, component); }
public void ReplaceMap(GamePlatformer.Model.Utils.IntVector2 newSizeInTiles, GamePlatformer.Model.Utils.TilePosition newStartTilePosition, GamePlatformer.Model.Utils.TilePosition newEndTilePosition) { var index = MapComponentsLookup.Map; var component = CreateComponent <GamePlatformer.Model.GameComponents.MapComponent>(index); component.sizeInTiles = newSizeInTiles; component.startTilePosition = newStartTilePosition; component.endTilePosition = newEndTilePosition; ReplaceComponent(index, component); }
public MapEntity SetMap(GamePlatformer.Model.Utils.IntVector2 newSizeInTiles, GamePlatformer.Model.Utils.TilePosition newStartTilePosition, GamePlatformer.Model.Utils.TilePosition newEndTilePosition) { if (hasMap) { throw new Entitas.EntitasException("Could not set Map!\n" + this + " already has an entity with GamePlatformer.Model.GameComponents.MapComponent!", "You should check if the context already has a mapEntity before setting it or use context.ReplaceMap()."); } var entity = CreateEntity(); entity.AddMap(newSizeInTiles, newStartTilePosition, newEndTilePosition); return(entity); }
public void ReplaceMap(GamePlatformer.Model.Utils.IntVector2 newSizeInTiles, GamePlatformer.Model.Utils.TilePosition newStartTilePosition, GamePlatformer.Model.Utils.TilePosition newEndTilePosition) { var entity = mapEntity; if (entity == null) { entity = SetMap(newSizeInTiles, newStartTilePosition, newEndTilePosition); } else { entity.ReplaceMap(newSizeInTiles, newStartTilePosition, newEndTilePosition); } }