Пример #1
0
        public SpriteManager(Game game, Vector2 touchPosition, Boolean isPressed, WorldObject world, ParticleEngine part)
            : base(game)
        {
            this.touchPosition = touchPosition;
            this.isPressed = isPressed;
            this.world = world;

            this.spriteBatch = new SpriteBatch(game.GraphicsDevice);
            this.part = part;

            if (content == null)
                content = new ContentManager(Game.Services, "Content");

            mainFont = content.Load<SpriteFont>("mainFont");
            touchTexture = content.Load<Texture2D>("sprites/touch");
            tileGrass = content.Load<Texture2D>("tiles/WorldLineTexture");
            gameOverlay = content.Load<Texture2D>("bg/gameOver");
            background = content.Load<Texture2D>("bg/background_gradient");
            parallax = content.Load<Texture2D>("bg/parallax_layer_cont");
            gatekeeper = content.Load<Texture2D>("gates/gatekeeper");

            tree2 = content.Load<Texture2D>("sprites/tree2");
            tree3 = content.Load<Texture2D>("sprites/tree3");
            tree4 = content.Load<Texture2D>("sprites/tree4");
        }
Пример #2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                List<Texture2D> textures = new List<Texture2D>();
                textures.Add(content.Load<Texture2D>("tex/star"));
                part = new ParticleEngine(textures, new Vector2(400, 240));

                world = new WorldObject(ScreenManager.Game, ScreenManager.SpriteBatch);

                // create worldline queue
                for (int i = 0; i < 800; i++)
                {
                    world.addLine(-1);
                }

                spriteManager = new SpriteManager(ScreenManager.Game, touchPosition, isPressed, world, part);
                ScreenManager.Game.Components.Add(spriteManager);
                Thread.Sleep(1000);

                ScreenManager.Game.ResetElapsedTime();
            }

#if WINDOWS_PHONE
            if (Microsoft.Phone.Shell.PhoneApplicationService.Current.State.ContainsKey("PlayerPosition"))
            {
                // playerPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["PlayerPosition"];
                // enemyPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["EnemyPosition"];
            }
        }