ILevel is the class any implementing game will need to extend to create specific levels. Once a level is created it should be passed to the game's RhinoXNAAdapter through the use of AddNewLevel(ILevel level).


Namespace: RhinoXNA

Public Functions
public ILevel()
public virtual void Update(GameTime gameTime)

Protected Variables
protected List<Character> _characters; 
protected InputBinding _inputBinding;

Protected Members
protectedabstract void RenderImpl()

Implementation Example

An example of creating a level implementation can be seen in ProjectAmbush's SpaceLevel class:

public class SpaceLevel : ILevel 
    public SpaceLevel() 
        : base() 
        RhinoXNAAdapter.Instance.AddEntities(RhinoLoader.GetGraphics("LoadFiles\\", "LoadFiles\\Space.lfi"));
        _inputBinding = new InputBinding(Keyboard.GetState(), Mouse.GetState());
     public override void Update(Microsoft.Xna.Framework.GameTime gameTime) 
             if (_inputBinding.CheckKeyDown(Keyboard.GetState(), Keys.Space))
                 RhinoXNAAdapter.Instance.AddNewMenu(new PauseMenu());
     public override void RenderImpl() 
          // This is a specific Ambush game object, not RhinoXNA specific

A key piece of this class is the first line that loads the file Space.lfi into the global list of graphics components (entities).The RenderImpl method needed to be overridden and is called in ILevel's Render.

Notice, the process for rendering graphics in a level is:

This process is to ensure the HUD elements are drawn on top of everything else.

Last edited Oct 7, 2010 at 6:42 PM by MattChristian, version 6


No comments yet.