Example #1
0
    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);
    }
Example #2
0
    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);
    }
Example #3
0
    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);
        }
    }