public override void Dispose(bool disposing) { light.Dispose(disposing); light = null; base.Dispose(disposing); }
public RollingCircleEnemy(Engine engine, Vector2 position) : base(engine, position) { animation = new Animation(engine, @"Characters\FlickeringCircle", 64, 64, 1, 2, 2, 15, Global.Animations.Repeat); animation.Play(); enemyPhysicsComponent = new EnemyPhysicsComponent(Engine, position, Global.Shapes.Circle); enemyPhysicsComponent.MainFixture.Body.LinearDamping = 2.0f; enemyPhysicsComponent.MainFixture.CollisionFilter.CollisionCategories = (Category)Global.CollisionCategories.Enemy; enemyPhysicsComponent.MainFixture.OnCollision += EnemyOnCollision; deathAnimation = new Animation(engine, @"Miscellaneous\Explosion", 512, 512, 3, 4, 9, 20, Global.Animations.PlayOnce); deathAnimation.Scale = 0.3f; deathAnimation.DrawOrder = int.MaxValue - 1; enemySound = Engine.Audio.GetCue("EnterTheVoid"); light = new Light(engine); light.Color = Color.White; light.Fov = MathHelper.TwoPi; light.Position = position; light.Range = 100; engine.AddComponent(this); }
public PlayerEnemy(Engine engine, Vector2 position) : base(engine, position) { DrawOrder = (int)Global.Layers.Player; Health = 100; deathAnimation = new Animation(engine, @"Miscellaneous\Explosion", 512, 512, 3, 4, 9, 20, Global.Animations.PlayOnce); deathAnimation.DrawOrder = int.MaxValue - 1; deathAnimation.Scale = 0.3f; PhysicsComponent = new EnemyPlayerPhysicsComponent(Engine, position); PhysicsComponent.MainFixture.Body.LinearDamping = 2.0f; PhysicsComponent.MainFixture.OnCollision += EnemyOnCollision; PhysicsComponent.WheelFixture.OnCollision += EnemyOnCollision; enemyPhysicsComponent = PhysicsComponent; airMovementForce = new Vector2(1.0f, 0.0f); airMovementWindow = 3000.0d; bullets = new List<Bullet>(); bulletTimer = double.MaxValue / 2; releasedFire = true; groundCache = new List<Fixture>(); wallCache = new List<Fixture>(); Position = position; light = new Light(engine); light.Color = Color.White; light.Fov = MathHelper.TwoPi; light.Position = position; light.Range = 250; light.ShadowType = Krypton.Lights.ShadowType.Illuminated; PhysicsComponent = new EnemyPlayerPhysicsComponent(Engine, position); PhysicsComponent.WheelFixture.OnCollision += PlayerEnemyOnCollision; PhysicsComponent.WheelFixture.OnSeparation += PlayerEnemyOnSeparation; // load visuals playerEnemyArmShootingRight = new Sprite(engine, @"Characters\PlayerEnemy\EnemyArmShootingRight"); playerEnemyArmShootingRight.DrawOrder = DrawOrder; playerEnemyStandingRight = new Sprite(engine, @"Characters\PlayerEnemy\EnemyStandingRight"); playerEnemyStandingRight.DrawOrder = DrawOrder; playerEnemyCrouchingRight = new Sprite(engine, @"Characters\PlayerEnemy\EnemyCrouchingRight"); playerEnemyCrouchingRight.DrawOrder = DrawOrder; playerEnemyJumpingRight = new Sprite(engine, @"Characters\PlayerEnemy\EnemyJumpingRight"); playerEnemyJumpingRight.DrawOrder = DrawOrder; playerEnemyFallingRight = new Sprite(engine, @"Characters\PlayerEnemy\EnemyFallingRight"); playerEnemyFallingRight.DrawOrder = DrawOrder; playerEnemyWalkingRight = new Animation(engine, @"Characters\PlayerEnemy\EnemyWalkingRight", 88, 132, 2, 4, 8, 4, Global.Animations.Repeat); playerEnemyWalkingRight.DrawOrder = DrawOrder; random = new Random(); Engine.AddComponent(this); }
public Bullet(Engine engine, Vector2 position, Vector2 direction, float angle, Global.CollisionCategories category) : base(engine) { DrawOrder = (int)Global.Layers.Projectiles; bulletPhysicsComponent = new BulletPhysicsComponent(engine, position, direction, angle, category); bulletPhysicsComponent.MainFixture.OnCollision += BulletOnCollision; bulletSprite = new Sprite(engine, @"Miscellaneous\RedBullet"); bulletSprite.DrawOrder = DrawOrder; bulletSprite.Angle = angle; light = new Light(engine); light.Color = Color.Red; light.Fov = MathHelper.TwoPi; light.Intensity = 0.8f; light.Position = bulletPhysicsComponent.Position; light.Range = 200; light.ShadowType = Krypton.Lights.ShadowType.Illuminated; switch (category) { case Global.CollisionCategories.PlayerBullet: bulletPhysicsComponent.MainFixture.CollisionFilter.CollidesWith = (Category)(Global.CollisionCategories.Enemy | Global.CollisionCategories.EnemyBullet | Global.CollisionCategories.Light | Global.CollisionCategories.Structure); break; case Global.CollisionCategories.EnemyBullet: bulletPhysicsComponent.MainFixture.CollisionFilter.CollidesWith = (Category)(Global.CollisionCategories.Player | Global.CollisionCategories.PlayerBullet | Global.CollisionCategories.Light | Global.CollisionCategories.Structure); break; default: // do nothing break; } collided = false; flashAnimation = new Animation(Engine, @"Miscellaneous\flash", 512, 512, 3, 3, 6, 20, Global.Animations.PlayOnce); flashAnimation.Scale = 0.4f; flashAnimation.Position = bulletPhysicsComponent.Position; flashAnimation.DrawOrder = (int)Global.Layers.Projectiles; flashLight = new Light(engine); flashLight.Color = Color.Yellow; flashLight.Fov = MathHelper.TwoPi; flashLight.Intensity = 0.8f; flashLight.Position = bulletPhysicsComponent.Position; flashLight.Range = 100; flashLight.ShadowType = Krypton.Lights.ShadowType.Illuminated; flashLight.IsOn = false; engine.AddComponent(this); }
public Enemy(Engine engine, Vector2 position) : base(engine) { audioEmitter = new AudioEmitter(); deathLight = new Light(engine); deathLight.Color = Color.Orange; deathLight.Fov = MathHelper.TwoPi; deathLight.IsOn = false; deathLight.Range = 200; Health = 100; engine.AddComponent(this); }
public override void Dispose(bool disposing) { if (bulletPhysicsComponent != null) { bulletPhysicsComponent.Dispose(disposing); bulletPhysicsComponent = null; } bulletSprite.Dispose(true); bulletSprite = null; light.Dispose(true); light = null; flashAnimation.Dispose(true); flashAnimation = null; flashLight.Dispose(true); flashLight = null; base.Dispose(disposing); }
public Player(Engine engine, Vector2 position) : base(engine) { DrawOrder = (int)Global.Layers.Player; Health = 100; airMovementForce = new Vector2(1.0f, 0.0f); airMovementWindow = 3000.0d; bullets = new List<Bullet>(); bulletTimer = double.MaxValue / 2; bloomSettings = BloomSettings.PresetSettings[0]; releasedFire = true; groundCache = new List<Fixture>(); wallCache = new List<Fixture>(); Position = position; AudioListener = new AudioListener(); AudioListener.Position = new Vector3(Position, 0); light = new Light(engine); light.Color = Color.White; light.Fov = MathHelper.TwoPi; light.Position = position; light.Range = 250; light.ShadowType = Krypton.Lights.ShadowType.Illuminated; PhysicsComponent = new PlayerPhysicsComponent(Engine, position); PhysicsComponent.WheelFixture.OnCollision += PlayerOnCollision; PhysicsComponent.WheelFixture.OnSeparation += PlayerOnSeparation; // load visuals playerArmShootingRight = new Sprite(engine, @"Characters\Player\PlayerArmShootingRight"); playerArmShootingRight.DrawOrder = DrawOrder; playerStandingRight = new Sprite(engine, @"Characters\Player\PlayerStandingRight"); playerStandingRight.DrawOrder = DrawOrder; playerArmStandingRight = new Sprite(engine, @"Characters\Player\PlayerArmStanding"); playerArmStandingRight.DrawOrder = DrawOrder + 1; playerCrouchingRight = new Sprite(engine, @"Characters\Player\PlayerCrouchingRight"); playerCrouchingRight.DrawOrder = DrawOrder; playerArmCrouchingRight = new Sprite(engine, @"Characters\Player\PlayerArmCrouchingRight"); playerArmCrouchingRight.DrawOrder = DrawOrder + 1; playerJumpingRight = new Sprite(engine, @"Characters\Player\PlayerJumpingRight"); playerJumpingRight.DrawOrder = DrawOrder; playerFallingRight = new Sprite(engine, @"Characters\Player\PlayerFallingRight"); playerFallingRight.DrawOrder = DrawOrder; playerArmAirRight = new Sprite(engine, @"Characters\Player\PlayerArmAirRight"); playerArmAirRight.DrawOrder = DrawOrder; playerWalkingRight = new Animation(engine, @"Characters\Player\PlayerWalkingRight", 88, 132, 2, 4, 8, 4, Global.Animations.Repeat); playerWalkingRight.DrawOrder = DrawOrder; playerFrontArmWalkingRight = new Animation(engine, @"Characters\Player\PlayerFrontArm", 88, 132, 2, 4, 8, 4, Global.Animations.Repeat); playerFrontArmWalkingRight.DrawOrder = DrawOrder + 1; playerBackArmWalkingRight = new Animation(engine, @"Characters\Player\PlayerBackArm", 88, 132, 2, 4, 8, 4, Global.Animations.Repeat); playerBackArmWalkingRight.DrawOrder = DrawOrder; deathAnimation = new Animation(engine, @"Miscellaneous\Explosion", 512, 512, 3, 4, 9, 20, Global.Animations.PlayOnce); deathAnimation.Scale = 0.3f; deathAnimation.DrawOrder = int.MaxValue - 1; Engine.AddComponent(this); }
public override void Dispose(bool disposing) { if (enemySound != null) { enemySound.Stop(AudioStopOptions.Immediate); enemySound.Dispose(); enemySound = null; } if (animation != null) { animation.Dispose(disposing); animation = null; } if (deathAnimation != null) { deathAnimation.Dispose(disposing); deathAnimation = null; } if (deathLight != null) { deathLight.Dispose(disposing); deathLight = null; } enemyPhysicsComponent.Dispose(true); enemyPhysicsComponent = null; base.Dispose(disposing); }