コード例 #1
0
ファイル: Soldier.cs プロジェクト: norleaf/Burgerman
        public override void Die()
        {
            //If statements to correct groundlevel for death animations when coming from various states.
            game.Level.MarkDead(this);
            if (CurrentState == State.Eating)
            {
                Position = new Vector2(Position.X, Position.Y - 7);
            }
            if (CurrentState == State.Walking)
            {
                Position = new Vector2(Position.X, Position.Y + 3);
            }

            AnimatedSprite corpse = new AnimatedSprite(game.SoldierDeathTexture, Position);

            Animation fall = new Animation(corpse, 200);

            fall.Loop = false;
            fall.Frames.Add(new Rectangle(0, 0, 73, 58));
            fall.Frames.Add(new Rectangle(73, 0, 73, 58));
            fall.Frames.Add(new Rectangle(146, 0, 73, 58));
            fall.Frames.Add(new Rectangle(219, 0, 146, 58));
            corpse.setAnimation(fall);
            game.Level.SpawnSpriteAtRuntime(corpse);
            game.SoldierDeathSound.Play(0.2f, 0f, 0f);
        }
コード例 #2
0
        public override void Die()
        {
            AnimatedSprite explodingHelicopter = new AnimatedSprite(game.ExplosionTexture, Position);

            explodingHelicopter.persistentSprite = false;
            Animation exploding = new Animation(explodingHelicopter, 100);

            exploding.Loop = false;
            exploding.Frames.Add(new Rectangle(0, 0, 200, 200));
            exploding.Frames.Add(new Rectangle(200, 0, 200, 200));
            exploding.Frames.Add(new Rectangle(0, 0, 200, 200));
            exploding.Frames.Add(new Rectangle(200, 0, 200, 200));
            explodingHelicopter.setAnimation(exploding);
            game.Level.SpawnSpriteAtRuntime(explodingHelicopter);

            game.HelicopterExplosionSound.Play(0.2f, 0f, 0f);
            game.ScreenShake = new ScreenShake(30, 4);
            game.Level.MarkDead(this);

            game.Level.ParticleEngines.Add(game.LevelConstructor.HelicopterDebris.Clone(Center));
        }
コード例 #3
0
ファイル: Child.cs プロジェクト: norleaf/Burgerman
        public override void Die()
        {
            game.ChildrenDied++;
            if (_fed)
            {
                game.ChildrenFed--;
            }
            game.Level.MarkDead(this);
            // game.ChildDead = true;
            AnimatedSprite corpse = new AnimatedSprite(game.ChildDeathTexture, Position);

            Animation fall = new Animation(corpse, 200);

            fall.Loop = false;
            fall.Frames.Add(new Rectangle(0, 0, 47, 47));
            fall.Frames.Add(new Rectangle(47, 0, 47, 47));
            fall.Frames.Add(new Rectangle(94, 0, 47, 47));
            fall.Frames.Add(new Rectangle(141, 0, 47, 47));
            corpse.setAnimation(fall);
            game.Level.SpawnSpriteAtRuntime(corpse);
        }