SetAnimation() public method

public SetAnimation ( string AnimationName ) : void
AnimationName string
return void
Exemplo n.º 1
0
        public override void Initialize()
        {
            enemyTexture = this.Content.Load<Texture2D>("commonEnemy");

            base.Initialize();
            Texture2D bullet2Texture = this.Content.Load<Texture2D>("bullet002-1");
            hero = new Hero(this.LuxGame, this, 100, 1, 1, 5, 2, null);
            Sprite heroSprite = new Sprite(hero, new List<String>() { "hero" });
            hero.Skin = heroSprite;
            hero.Position = new Vector2(400, 400);

            win = new MenuWindow(this, new Vector2(10, 10), deadEnemyNumber.ToString());
            winLife = new MenuWindow(this, new Vector2(640, 10), hero.Life.ToString());
            winTime = new MenuWindow(this, new Vector2(250, 10), ((int)(30 - elapsed)).ToString());

            ListePosition.Add(new Vector2(100, 100));
            ListePosition.Add(new Vector2(700, 100));
            ListePosition.Add(new Vector2(400, 100));

            ShotPool shots = new ShotPool(LuxGame, this, false, 0.2, 150, 150, 8, 4, bullet2Texture, null);

            for (int i = 0; i < 3; i++)
            {
                ShootsHero shooter = new ShootsHero(this.LuxGame, this, shots, null);
                Game.Components.Add(shooter);
                shootsHeros.Add(shooter);
            }

            GenericEnemy enem;
            for (int i = 0; i < 3; i++)
            {
                enem = new GenericEnemy(LuxGame, this, 500, 10, 10, null);
                Sprite enemySkin = new Sprite(enem, new List<Texture2D>() { enemyTexture }, null);
                enem.Skin = enemySkin;
                enem.Skin.SetAnimation(enemyTexture.Name);
                enem.Position = new Vector2(400, 100);
                enemies.Add(enem);
                Game.Components.Add(enem);
                Game.Components.Add(enemySkin);
                shootsHeros[i].Associate(enem);
            }
            Game.Components.Add(shots);
            Game.Components.Add(hero);
            Game.Components.Add(heroSprite);

            // Phase de test
            shots = new ShotPool(LuxGame, this);
            Game.Components.Add(shots);

            heroSprite.SetAnimation("hero");
        }
        public override void Initialize()
        {
            enemyTexture = this.Content.Load<Texture2D>("commonEnemy");

            base.Initialize();
            Texture2D bullet2Texture = this.Content.Load<Texture2D>("bullet002-1");
            hero = new Hero(this.LuxGame, this, 200, 1, 1, 5, 2, null);
            Sprite heroSprite = new Sprite(hero, new List<String>() { "hero" });
            hero.Skin = heroSprite;
            hero.Position = new Vector2(400, 400);

            ListePosition.Add(new Vector2(100, 100));
            ListePosition.Add(new Vector2(700, 100));
            ListePosition.Add(new Vector2(400, 100));

            ShotPool shots = new ShotPool(LuxGame, this, false, 0.2, 150, 150, 8, 4, bullet2Texture, null);

            GenericEnemy enem;
            for (int i = 0; i < 3; i++)
            {
                enem = new GenericEnemy(LuxGame, this, 500, 10, 10, null);
                Sprite enemySkin = new Sprite(enem, new List<Texture2D>() { enemyTexture }, null);
                enem.Skin = enemySkin;
                enem.Skin.SetAnimation(enemyTexture.Name);
                enem.Position = new Vector2(400, 100);
                enemies.Add(enem);
                Game.Components.Add(enem);
                Game.Components.Add(enemySkin);
            }
            foreach (Enemy enemy in enemies.ToList<Enemy>())
            {
                Game.Components.Add(new ShootsHero(this.LuxGame, this, shots, enemy));
            }
            Game.Components.Add(shots);
            Game.Components.Add(hero);
            Game.Components.Add(heroSprite);

            // Phase de test
            shots = new ShotPool(LuxGame, this);
            Game.Components.Add(shots);

            heroSprite.SetAnimation("hero");
        }