public UnitDrawer(Game game, UnitData data) : base(game) { mRenderMan = ((GameMain)game).RenderMan; mHexTileMap = ((GameMain)game).HexTileMap; mUnitData = data; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { RenderMan = new RenderMan(this); // provides rendering utils GameWorld = new GameWorld(this); // holds game state InputMan = new InputMan(this, GameWorld); // handles user input // process input events before updating game state Components.Add(InputMan); Components.Add(GameWorld); mHexTileMap = new HexTileMap(this, GameWorld.MapData); mUnitDrawer = new UnitDrawer(this, GameWorld.UnitData); mUserCursor = new UserCursor(this); mUserCursor.DrawUserCursor = DrawUserCursor; mUserCursor.PushBoundaryEvent += new EventHandler(mUserCursor_PushBoundaryEvent); mUserCursor.GamePadEnabled = true; mUserCursor.KeyboardEnabled = true; // order in which components are added determines draw order Components.Add(mHexTileMap); Components.Add(mUnitDrawer); Components.Add(mUserCursor); #if !XBOX // process Lua scripts LuaEngine = new Lua(); LuaEngine.RegisterFunction("MapData", GameWorld.MapData, GameWorld.MapData.GetType().GetMethod("AddData")); LuaEngine.DoFile("scripts/main.lua"); #endif base.Initialize(); }