示例#1
0
 public Tile(Game game, Zone ParentZone, Vector2 tileLocation)
     : base(game)
 {
     // TODO: Construct any child components here
     parentZone = ParentZone;
     location = tileLocation;
 }
        /// <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()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Zone init
            gameZone = new Zone(this,31,31);
            Components.Add(gameZone);

            // Create the first spreadsheet to be used
            SimpleSpritesheet = new Spritesheet();

            // Publish the services to be available to the entire application.
            Services.AddService(typeof(SpriteBatch), spriteBatch);
            Services.AddService(typeof(Spritesheet), SimpleSpritesheet);

            base.Initialize();
        }