Пример #1
0
 public UnitDrawer(Game game, UnitData data)
     : base(game)
 {
     mRenderMan = ((GameMain)game).RenderMan;
     mHexTileMap = ((GameMain)game).HexTileMap;
     mUnitData = data;
 }
Пример #2
0
        public RenderUnit(RenderMan renderMan)
        {
            render = renderMan;

            GenerateUnitBackingGeometry();
        }
Пример #3
0
 public RenderQuad(RenderMan render)
 {
     this.render = render;
     GenerateQuadGeometry(QuadSize);
 }
Пример #4
0
        /// <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();
        }