Level ClassDelta Engine Documentation
Simple 2D map of TileType data to be used for 2D tile games or for game logic tests. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content ContentData
    DeltaEngine.GameLogic Level
      CreepyTowers.Levels GameLevel
      DeltaEngine.GameLogic.Tests MockLevel
      DeltaEngine.Rendering3D.Shapes.Tests MockLevel

Namespace: DeltaEngine.GameLogic
Assembly: DeltaEngine.GameLogic (in DeltaEngine.GameLogic.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class Level : ContentData

The Level type exposes the following members.

Constructors

  NameDescription
Protected methodLevel(String)
Initializes a new instance of the Level class
Public methodLevel(Size)
Initializes a new instance of the Level class
Top
Methods

  NameDescription
Public methodAddWave
Protected methodCreateDefault (Inherited from ContentData.)
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Overrides ContentData DisposeData .)
Public methodGetAllTilesOfType
Public methodGetColor
Public methodGetIndexForMapData
Public methodStatic memberGetIntersectionWithFloor
Public methodGetMapCoordinates
Public methodGetTileIndex
Public methodGetWorldCoordinates
Public methodInitializeData
Public methodInternalCreateDefault (Inherited from ContentData.)
Public methodIsInsideLevelGrid
Public methodIsTileInteractable
Protected methodLoadData (Overrides ContentData LoadData(Stream).)
Public methodSetTile
Public methodSetTileWithScreenPosition
Protected methodStoreGameTriggers
Public methodToString (Inherited from ContentData.)
Public methodToTextForXml
Protected methodUpdateLevelData
Top
Fields

  NameDescription
Protected fieldContentChanged (Inherited from ContentData.)
Protected fielddata
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Inherited from ContentData.)
Public propertyStatic memberCurrent
Public propertyGoalPoints
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyMapData
Public propertyMetaData (Inherited from ContentData.)
Public propertyModelName
Public propertyName (Inherited from ContentData.)
Public propertyRenderIn3D
Public propertySize
Public propertySpawnPoints
Public propertyTriggers
Public propertyWaves
Top
Events

  NameDescription
Public eventTileChanged
Top
Remarks

Tests: DeltaEngine.GameLogic.Tests.LevelTests
Examples

19 unit tests call DeltaEngine.GameLogic.Level
[Test, CloseAfterFirstFrame]
public void Start()
{
    TileMap map = CreateSimple2X3TileMap();
    Assert.AreEqual(2, map.Width);
    Assert.AreEqual(3, map.Height);
}
[Test, CloseAfterFirstFrame]
public void SaveAndLoadMapData()
{
    TileMap map = CreateSimple2X3TileMap();
    string mapData = map.Save();
    string newLine = Environment.NewLine;
    string expectedData = "E." + newLine + "X." + newLine + "S." + newLine;
    Assert.AreEqual(expectedData, mapData);
    var loadedMap = new TileMap(mapData);
    Assert.AreEqual(expectedData, loadedMap.Save());
}
[Test, CloseAfterFirstFrame]
public void CanNotCreateTileMapWithoutData()
{
    const string MapData = "";
    Assert.Throws<TileMap.NoTileMapData>(() => new TileMap(MapData));
}
See Also