public BodyPart(SpriteSheet spriteSheet, Transform transform)
 {
     m_transform = transform;
     m_sprite = new Sprite(Globals.TheGame, spriteSheet, m_transform);
     m_physics = new PhysicsComponent(Globals.TheGame, m_transform);
     //PlaceInFrontOf(parent);
     //Hide();
 }
 public PhysicsComponent(PhysicsComponent objectToCopy, Transform transform)
 {
     m_myGame = objectToCopy.m_myGame;
     m_transform = transform;
     Mass = objectToCopy.Mass;
     Friction = objectToCopy.Friction;
     Restitution = objectToCopy.Restitution;
     AirFriction = objectToCopy.AirFriction;
 }
Ejemplo n.º 3
0
        public Coin(COIN_TYPE type) : base()
        {
            _type           = type;
            m_sprite        = new Sprite(Globals.TheGame, CoinTextures[(int)type], Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_physics       = new PhysicsComponent(Globals.TheGame, Transform);
            m_animation     = new SpriteSheetAnimation(m_sprite, 0, 5, 0.1f, -1);
            m_animation.Start();
            m_physics.Throw((float)Globals.Random.NextDouble() * 25, Globals.Random.Next(-30, -10), 0);
            m_physics.Mass        = 1.3f;
            m_physics.Restitution = 0.75f;
            //m_physics.GroundLevel = Globals.Random.Next(-8, 3);
            m_physics.GroundLevel = 0;
            m_circleCollider      = new CircleCollider(this);

            World.UL_Global.Add(this, 0);
            World.DL_ItemDrops.Add(this, 1);

            //ADDTHISLATER
            //Backpacker.HitPlayerColliders.Add(m_circleCollider, PickUp);
        }
Ejemplo n.º 4
0
        public Coin(COIN_TYPE type)
            : base()
        {
            _type = type;
            m_sprite = new Sprite(Globals.TheGame, CoinTextures[(int)type], Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_physics = new PhysicsComponent(Globals.TheGame, Transform);
            m_animation = new SpriteSheetAnimation(m_sprite, 0, 5, 0.1f, -1);
            m_animation.Start();
            m_physics.Throw((float)Globals.Random.NextDouble() * 25, Globals.Random.Next(-30, -10), 0);
            m_physics.Mass = 1.3f;
            m_physics.Restitution = 0.75f;
            //m_physics.GroundLevel = Globals.Random.Next(-8, 3);
            m_physics.GroundLevel = 0;
            m_circleCollider = new CircleCollider(this);

            World.UL_Global.Add(this, 0);
            World.DL_ItemDrops.Add(this, 1);

            //ADDTHISLATER
            //Backpacker.HitPlayerColliders.Add(m_circleCollider, PickUp);
        }
        public GameObject(GameObject objectToCopy)
        {
            m_transform = new Transform(objectToCopy.Transform);
            if (objectToCopy.Sprite != null)
                m_sprite = new Sprite(objectToCopy.Sprite, m_transform);
            if (objectToCopy.Physics != null)
                m_physics = new PhysicsComponent(objectToCopy.Physics, m_transform);
            //if (objectToCopy.Destructible != null)
            //    m_physics = new DestructibleComponent(objectToCopy.Destructible, m_transform);
            if (objectToCopy.m_updateList != null)
                m_updateList = objectToCopy.m_updateList;
            if (objectToCopy.m_drawingList != null)
                m_drawingList = objectToCopy.m_drawingList;

            if (objectToCopy.m_spawners != null)
            {
                m_spawners = new List<Spawner>();
                for (int i = 0; i < objectToCopy.m_spawners.Count; ++i)
                    m_spawners.Add(new Spawner(m_spawners[i]));
            }
        }
 public PhysicsParticle(Sprite sprite, PhysicsParticleData data)
 {
     //_burntTexture = TextureManager.GetBurnt(textureName);
     //BindParent(parent);
     m_sprite = sprite;
     m_theGame = m_sprite.TheGame;
     m_transform = sprite.Transform;
     m_physics = new PhysicsComponent(m_theGame, sprite.Transform);
     m_data = data;
 }
 public PhysicsParticle(MyGame theGame, SpriteSheet spriteSheet, PhysicsParticleData data)
 {
     m_sprite = new Sprite(theGame, spriteSheet, new Transform());
     m_theGame = theGame;
     m_transform = m_sprite.Transform;
     m_physics = new PhysicsComponent(m_theGame, m_sprite.Transform);
     m_data = data;
 }
        //        public Tpl_PogoZombie()
        //    : base(typeof(PogoZombie), "e_pz")
        //{
        //    _hp = 3;
        //    _speed = 2.4f;
        //    _jumpForce = 25;
        //    _appearanceRate = 30;
        //}
        public PogoZombie()
            : base()
        {
            m_jumpForce = Globals.Random.Next(-JumpForceInterval, JumpForceInterval + 1) + JumpForce;

            m_sprite = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_pogo", 1, 8), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_physics = new PhysicsComponent(Globals.TheGame, Transform);
            m_loot = Loot.GenerateLoot(12);

            m_currentFrame = 0;

            ObjectState.BeginAction = delegate()
            {
                m_sprite.SetFrame(m_currentFrame);
            };
            ObjectState.StandbyAction = delegate()
            {
                m_sprite.SetFrame(m_currentFrame + 1);
            };
            ObjectState.DestroyAction = delegate()
            {
                m_destructible.ClearHitEvents();
                Backpacker.HitPlayerColliders.Remove(m_collider);
            };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); });

            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, 4);
            m_hitAnimation = new HitAnimation(World.baseEffect);
            m_impactBox = new AABB(new Transform(Transform, true), new Vector2(20, 60));
            m_impactBox.Transform.Position = new Vector2(5, -54);
            m_shurikenReceiver = new ShurikenReceiver(Transform, m_impactBox, 5);
            m_measurer = new AABBMeasurer(m_impactBox);

            //_projections = new BodyPart[] {
            //    null,
            //    new BodyPart(this, new Vector2(0, -65), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-10, -55), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(15, -75), "bp_basezombiehead"),
            //};

            //_destroyProjections = new BodyPart[]
            //{
            //    new BodyPart(this, new Vector2(10, -50), "bp_basezombieupperb"),
            //    new BodyPart(this, new Vector2(10, -50), "bp_pogostick"),
            //    new BodyPart(this, new Vector2(10, -10), "bp_basezombielowerb")
            //};

            ///
            ///	Body parts
            ///

            m_bodyParts = new ParticleSystem(Globals.TheGame, 6);

            m_head = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiehead"), new Transform(Transform, true));
            m_head.Transform.Position = new Vector2(7, -97);
            m_bodyParts.AddParticle(m_head);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-20, -70);
            m_bodyParts.AddParticle(m_armR);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombielowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(0, -40);
            m_bodyParts.AddParticle(m_lowerB);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombieupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(0, -65);
            m_bodyParts.AddParticle(m_upperB);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(-20, -70);
            m_bodyParts.AddParticle(m_armL);

            m_pogoStick = new BodyPart(TextureLibrary.GetSpriteSheet("bp_pogostick"), new Transform(Transform, true));
            m_pogoStick.Transform.Position = new Vector2(-6, -40);
            m_bodyParts.AddParticle(m_pogoStick);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
            {
                m_currentFrame = 2;
                m_sprite.SetFrame(m_currentFrame);
                m_head.Pop(-1.1f, 800, true);
            }));
            m_destructible.AddHealthEvent(2, false, new MethodAction(delegate()
            {
                m_currentFrame = 4;
                m_sprite.SetFrame(m_currentFrame);
                m_armL.Pop(-1.1f, 800, true);
            }));
            m_destructible.AddHealthEvent(1, false, new MethodAction(delegate()
            {
                m_currentFrame = 6;
                m_sprite.SetFrame(m_currentFrame);
                m_armR.Pop(-1.1f, 800, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 800, true);
                m_lowerB.Pop(-1.1f, 800, true);
                m_pogoStick.Pop(-1.1f, 200, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }
Ejemplo n.º 9
0
        public FatZombie()
        {
            m_physics       = new PhysicsComponent(Globals.TheGame, Transform);
            m_sprite        = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_phat", 1, 12), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1);
            m_loot          = Loot.GenerateLoot(12);

            ObjectState.BeginAction   = delegate() { m_actionManager.StartNew(m_full); };
            ObjectState.StandbyAction = delegate() { m_actionManager.Stop(); m_sprite.SetFrame(0); };
            ObjectState.DestroyAction = delegate() { m_destructible.ClearHitEvents(); Backpacker.HitPlayerColliders.Remove(m_collider); };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); });

            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, HP);

            m_impactBox = new AABB(new Transform(Transform, true), new Vector2(72, 67));
            m_impactBox.Transform.Position = new Vector2(13, -70);
            m_shurikenReceiver             = new ShurikenReceiver(Transform, m_impactBox, 10);
            m_hitAnimation = new HitAnimation(World.baseEffect);
            m_measurer     = new AABBMeasurer(new AABB(new Transform(Transform, true), new Vector2(50, 50)));

            m_full        = new SpriteSheetAnimation(m_sprite, 0, 1, 0.7f, -1);
            m_noHead1     = new SpriteSheetAnimation(m_sprite, 2, 3, 0.7f, -1);
            m_noHead2     = new SpriteSheetAnimation(m_sprite, 4, 5, 0.7f, -1);
            m_noRightArm  = new SpriteSheetAnimation(m_sprite, 6, 7, 0.7f, -1);
            m_noLeftArm   = new SpriteSheetAnimation(m_sprite, 8, 9, 0.7f, -1);
            m_noShoulders = new SpriteSheetAnimation(m_sprite, 10, 11, 0.7f, -1);

            m_actionManager = new SingleActionManager();
            m_actionManager.StartNew(m_full);


            //_projections = new BodyPart[]
            //{
            //    null,
            //    new BodyPart(this, new Vector2(0, -55), "bp_fatshoulders"),
            //    new BodyPart(this, new Vector2(-15, -75), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-15, -75), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-30, -100), "bp_fathead2"),
            //    new BodyPart(this, new Vector2(-30, -115), "bp_fathead1"),
            //};

            //_destroyProjections = new BodyPart[] {
            //    new BodyPart(this, new Vector2(0, -45), "bp_fatupperb"),
            //    new BodyPart(this, new Vector2(0, -10), "bp_fatlowerb"),
            //};
            m_bodyParts = new ParticleSystem(Globals.TheGame, 7);

            m_head1 = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fathead1"), new Transform(Transform, true));
            m_head1.Transform.Position = new Vector2(-30, -110);
            m_bodyParts.AddParticle(m_head1);

            m_head2 = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fathead2"), new Transform(Transform, true));
            m_head2.Transform.Position = new Vector2(-30, -100);
            m_bodyParts.AddParticle(m_head2);

            m_shoulders = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatshoulders"), new Transform(Transform, true));
            m_shoulders.Transform.Position = new Vector2(0, -80);
            m_bodyParts.AddParticle(m_shoulders);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(-15, -75);
            m_bodyParts.AddParticle(m_armL);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-15, -75);
            m_bodyParts.AddParticle(m_armR);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(15, -65);
            m_bodyParts.AddParticle(m_upperB);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatlowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(15, -27);
            m_bodyParts.AddParticle(m_lowerB);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(7, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noHead1);
                m_head1.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(6, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noHead2);
                m_head2.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(5, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noRightArm);
                m_armR.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(4, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noLeftArm);
                m_armL.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noShoulders);
                m_shoulders.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 500, true);
                m_lowerB.Pop(-1.1f, 500, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }
        //        public Tpl_PogoZombie()
        //    : base(typeof(PogoZombie), "e_pz")
        //{
        //    _hp = 3;
        //    _speed = 2.4f;
        //    _jumpForce = 25;
        //    _appearanceRate = 30;
        //}

        public PogoZombie() : base()
        {
            m_jumpForce = Globals.Random.Next(-JumpForceInterval, JumpForceInterval + 1) + JumpForce;

            m_sprite        = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_pogo", 1, 8), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_physics       = new PhysicsComponent(Globals.TheGame, Transform);
            m_loot          = Loot.GenerateLoot(12);

            m_currentFrame = 0;

            ObjectState.BeginAction = delegate()
            {
                m_sprite.SetFrame(m_currentFrame);
            };
            ObjectState.StandbyAction = delegate()
            {
                m_sprite.SetFrame(m_currentFrame + 1);
            };
            ObjectState.DestroyAction = delegate()
            {
                m_destructible.ClearHitEvents();
                Backpacker.HitPlayerColliders.Remove(m_collider);
            };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); });

            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, 4);
            m_hitAnimation = new HitAnimation(World.baseEffect);
            m_impactBox    = new AABB(new Transform(Transform, true), new Vector2(20, 60));
            m_impactBox.Transform.Position = new Vector2(5, -54);
            m_shurikenReceiver             = new ShurikenReceiver(Transform, m_impactBox, 5);
            m_measurer = new AABBMeasurer(m_impactBox);

            //_projections = new BodyPart[] {
            //    null,
            //    new BodyPart(this, new Vector2(0, -65), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-10, -55), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(15, -75), "bp_basezombiehead"),
            //};

            //_destroyProjections = new BodyPart[]
            //{
            //    new BodyPart(this, new Vector2(10, -50), "bp_basezombieupperb"),
            //    new BodyPart(this, new Vector2(10, -50), "bp_pogostick"),
            //    new BodyPart(this, new Vector2(10, -10), "bp_basezombielowerb")
            //};

            ///
            ///	Body parts
            ///

            m_bodyParts = new ParticleSystem(Globals.TheGame, 6);

            m_head = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiehead"), new Transform(Transform, true));
            m_head.Transform.Position = new Vector2(7, -97);
            m_bodyParts.AddParticle(m_head);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-20, -70);
            m_bodyParts.AddParticle(m_armR);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombielowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(0, -40);
            m_bodyParts.AddParticle(m_lowerB);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombieupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(0, -65);
            m_bodyParts.AddParticle(m_upperB);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(-20, -70);
            m_bodyParts.AddParticle(m_armL);

            m_pogoStick = new BodyPart(TextureLibrary.GetSpriteSheet("bp_pogostick"), new Transform(Transform, true));
            m_pogoStick.Transform.Position = new Vector2(-6, -40);
            m_bodyParts.AddParticle(m_pogoStick);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
            {
                m_currentFrame = 2;
                m_sprite.SetFrame(m_currentFrame);
                m_head.Pop(-1.1f, 800, true);
            }));
            m_destructible.AddHealthEvent(2, false, new MethodAction(delegate()
            {
                m_currentFrame = 4;
                m_sprite.SetFrame(m_currentFrame);
                m_armL.Pop(-1.1f, 800, true);
            }));
            m_destructible.AddHealthEvent(1, false, new MethodAction(delegate()
            {
                m_currentFrame = 6;
                m_sprite.SetFrame(m_currentFrame);
                m_armR.Pop(-1.1f, 800, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 800, true);
                m_lowerB.Pop(-1.1f, 800, true);
                m_pogoStick.Pop(-1.1f, 200, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }
Ejemplo n.º 11
0
        public BasicZombie()
            : base()
        {
            m_physics       = new PhysicsComponent(Globals.TheGame, Transform);
            m_sprite        = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_base", 1, 8), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_loot          = Loot.GenerateLoot(4);

            ObjectState.BeginAction = delegate()
            {
                m_actionManager.StartNew(m_full);
            };
            ObjectState.StandbyAction = delegate()
            {
                m_actionManager.Stop();
                m_sprite.SetFrame(0);
            };
            ObjectState.DestroyAction = delegate()
            {
                m_destructible.ClearHitEvents();
                Backpacker.HitPlayerColliders.Remove(m_collider);
            };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); });
            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, HP);


            m_impactBox = new AABB(new Transform(Transform, true), new Vector2(22, 42));
            m_impactBox.Transform.Position = new Vector2(13, -44);
            m_measurer         = new AABBMeasurer(m_impactBox);
            m_shurikenReceiver = new ShurikenReceiver(Transform, m_impactBox, 5);
            m_hitAnimation     = new HitAnimation(World.baseEffect);

            m_full       = new SpriteSheetAnimation(m_sprite, 0, 1, 0.5f, -1);
            m_noHead     = new SpriteSheetAnimation(m_sprite, 2, 3, 0.5f, -1);
            m_noLeftArm  = new SpriteSheetAnimation(m_sprite, 4, 5, 0.5f, -1);
            m_noRightArm = new SpriteSheetAnimation(m_sprite, 6, 7, 0.5f, -1);

            m_actionManager = new SingleActionManager();

            //Transform headTransform = new Transform(Transform, true
            //_projections = new BodyPart[] {
            //    null,
            //    new BodyPart(this, new Vector2(0, -65), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-10, -55), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(15, -75), "bp_basezombiehead"),
            // new BodyPart(this, new Vector2(10, -50), "bp_basezombieupperb"),
            //   new BodyPart(this, new Vector2(10, -10), "bp_basezombielowerb")
            //};


            ///
            /// Body Parts
            ///
            m_bodyParts = new ParticleSystem(Globals.TheGame, 5);

            m_head = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiehead"), new Transform(Transform, true));
            m_head.Transform.Position = new Vector2(5, -50);
            m_bodyParts.AddParticle(m_head);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(5, -30);
            m_bodyParts.AddParticle(m_armL);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-5, -30);
            m_bodyParts.AddParticle(m_armR);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombieupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(0, -30);
            m_bodyParts.AddParticle(m_upperB);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombielowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(0, -10);
            m_bodyParts.AddParticle(m_lowerB);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noHead);
                m_head.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(2, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noLeftArm);
                m_armL.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(1, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noRightArm);
                m_armR.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 500, true);
                m_lowerB.Pop(-1.1f, 500, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }
        public FatZombie()
        {
            m_physics = new PhysicsComponent(Globals.TheGame, Transform);
            m_sprite = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_phat", 1, 12), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1);
            m_loot = Loot.GenerateLoot(12);

            ObjectState.BeginAction = delegate() { m_actionManager.StartNew(m_full); };
            ObjectState.StandbyAction = delegate() { m_actionManager.Stop(); m_sprite.SetFrame(0); };
            ObjectState.DestroyAction = delegate() { m_destructible.ClearHitEvents(); Backpacker.HitPlayerColliders.Remove(m_collider); };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); } );

            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, HP);

            m_impactBox = new AABB(new Transform(Transform, true), new Vector2(72, 67));
            m_impactBox.Transform.Position = new Vector2(13, -70);
            m_shurikenReceiver = new ShurikenReceiver(Transform, m_impactBox, 10);
            m_hitAnimation = new HitAnimation(World.baseEffect);
            m_measurer = new AABBMeasurer(new AABB(new Transform(Transform, true), new Vector2(50, 50)));

            m_full = new SpriteSheetAnimation(m_sprite, 0, 1, 0.7f, -1);
            m_noHead1 = new SpriteSheetAnimation(m_sprite, 2, 3, 0.7f, -1);
            m_noHead2 = new SpriteSheetAnimation(m_sprite, 4, 5, 0.7f, -1);
            m_noRightArm = new SpriteSheetAnimation(m_sprite, 6, 7, 0.7f, -1);
            m_noLeftArm = new SpriteSheetAnimation(m_sprite, 8, 9, 0.7f, -1);
            m_noShoulders = new SpriteSheetAnimation(m_sprite, 10, 11, 0.7f, -1);

            m_actionManager = new SingleActionManager();
            m_actionManager.StartNew(m_full);

            //_projections = new BodyPart[]
            //{
            //    null,
            //    new BodyPart(this, new Vector2(0, -55), "bp_fatshoulders"),
            //    new BodyPart(this, new Vector2(-15, -75), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-15, -75), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-30, -100), "bp_fathead2"),
            //    new BodyPart(this, new Vector2(-30, -115), "bp_fathead1"),
            //};

            //_destroyProjections = new BodyPart[] {
            //    new BodyPart(this, new Vector2(0, -45), "bp_fatupperb"),
            //    new BodyPart(this, new Vector2(0, -10), "bp_fatlowerb"),
            //};
            m_bodyParts = new ParticleSystem(Globals.TheGame, 7);

            m_head1 = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fathead1"), new Transform(Transform, true));
            m_head1.Transform.Position = new Vector2(-30, -110);
            m_bodyParts.AddParticle(m_head1);

            m_head2 = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fathead2"), new Transform(Transform, true));
            m_head2.Transform.Position = new Vector2(-30, -100);
            m_bodyParts.AddParticle(m_head2);

            m_shoulders = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatshoulders"), new Transform(Transform, true));
            m_shoulders.Transform.Position = new Vector2(0, -80);
            m_bodyParts.AddParticle(m_shoulders);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(-15, -75);
            m_bodyParts.AddParticle(m_armL);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-15, -75);
            m_bodyParts.AddParticle(m_armR);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(15, -65);
            m_bodyParts.AddParticle(m_upperB);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_fatlowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(15, -27);
            m_bodyParts.AddParticle(m_lowerB);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(7, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noHead1);
                m_head1.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(6, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noHead2);
                m_head2.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(5, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noRightArm);
                m_armR.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(4, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noLeftArm);
                m_armL.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noShoulders);
                m_shoulders.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 500, true);
                m_lowerB.Pop(-1.1f, 500, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }
        public BasicZombie()
            : base()
        {
            m_physics = new PhysicsComponent(Globals.TheGame, Transform);
            m_sprite = new Sprite(Globals.TheGame, TextureLibrary.GetSpriteSheet("zombie_base", 1, 8), Transform);
            m_sprite.Origin = new Vector2(0.5f, 1.0f);
            m_loot = Loot.GenerateLoot(4);

            ObjectState.BeginAction = delegate()
            {
                m_actionManager.StartNew(m_full);
            };
            ObjectState.StandbyAction = delegate()
            {
                m_actionManager.Stop();
                m_sprite.SetFrame(0);
            };
            ObjectState.DestroyAction = delegate()
            {
                m_destructible.ClearHitEvents();
                Backpacker.HitPlayerColliders.Remove(m_collider);
            };

            m_collider = new AABBCollider(this, new AABB(m_sprite));
            Backpacker.HitPlayerColliders.Add(m_collider, delegate(Collider other) { m_physics.Throw(10.0f, -10.0f, 0.1f); });
            m_destructible = new DestructibleComponent(Transform, m_collider, m_collider.AABB, HP);

            m_impactBox = new AABB(new Transform(Transform, true), new Vector2(22, 42));
            m_impactBox.Transform.Position = new Vector2(13, -44);
            m_measurer = new AABBMeasurer(m_impactBox);
            m_shurikenReceiver = new ShurikenReceiver(Transform, m_impactBox, 5);
            m_hitAnimation = new HitAnimation(World.baseEffect);

            m_full = new SpriteSheetAnimation(m_sprite, 0, 1, 0.5f, -1);
            m_noHead = new SpriteSheetAnimation(m_sprite, 2, 3, 0.5f, -1);
            m_noLeftArm = new SpriteSheetAnimation(m_sprite, 4, 5, 0.5f, -1);
            m_noRightArm = new SpriteSheetAnimation(m_sprite, 6, 7, 0.5f, -1);

            m_actionManager = new SingleActionManager();

            //Transform headTransform = new Transform(Transform, true
            //_projections = new BodyPart[] {
            //    null,
            //    new BodyPart(this, new Vector2(0, -65), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(-10, -55), "bp_basezombiearm"),
            //    new BodyPart(this, new Vector2(15, -75), "bp_basezombiehead"),
             // new BodyPart(this, new Vector2(10, -50), "bp_basezombieupperb"),
             //   new BodyPart(this, new Vector2(10, -10), "bp_basezombielowerb")
            //};

            ///
            /// Body Parts
            ///
            m_bodyParts = new ParticleSystem(Globals.TheGame, 5);

            m_head = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiehead"), new Transform(Transform, true));
            m_head.Transform.Position = new Vector2(5, -50);
            m_bodyParts.AddParticle(m_head);

            m_armL = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armL.Transform.Position = new Vector2(5, -30);
            m_bodyParts.AddParticle(m_armL);

            m_armR = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombiearm"), new Transform(Transform, true));
            m_armR.Transform.Position = new Vector2(-5, -30);
            m_bodyParts.AddParticle(m_armR);

            m_upperB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombieupperb"), new Transform(Transform, true));
            m_upperB.Transform.Position = new Vector2(0, -30);
            m_bodyParts.AddParticle(m_upperB);

            m_lowerB = new BodyPart(TextureLibrary.GetSpriteSheet("bp_basezombielowerb"), new Transform(Transform, true));
            m_lowerB.Transform.Position = new Vector2(0, -10);
            m_bodyParts.AddParticle(m_lowerB);

            ///
            ///Hit events
            ///
            m_destructible.SetHitEvent(AttackType.Shuriken, OnShurikenHit);
            m_destructible.SetHitEvent(AttackType.Slash, OnSliceHit);

            ///
            /// Health events
            ///
            m_destructible.AddHealthEvent(3, false, new MethodAction(delegate()
                {
                    m_actionManager.StartNew(m_noHead);
                    m_head.Pop(-1.1f, 500, true);
                }));
            m_destructible.AddHealthEvent(2, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noLeftArm);
                m_armL.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(1, false, new MethodAction(delegate()
            {
                m_actionManager.StartNew(m_noRightArm);
                m_armR.Pop(-1.1f, 500, true);
            }));
            m_destructible.AddHealthEvent(0, false, new MethodAction(delegate()
            {
                m_upperB.Pop(-1.1f, 500, true);
                m_lowerB.Pop(-1.1f, 500, true);
                ObjectState.Destroy();
            }));

            ObjectState.Begin();
        }