// 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(); }
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(); }