public Component(Engine engine) { Engine = engine; Disposed = false; Visible = true; drawOrder = 0; }
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 Light(Engine engine) : base(engine) { light = new Light2D(); light.Texture = Engine.Lighting.PointLightTexture; Engine.Lighting.Krypton.Lights.Add(light); Engine.AddComponent(this); }
/// <summary> /// Loads and manages maps. /// </summary> /// <param name="game">Game reference.</param> /// <param name="mapPath">The relative path to the map.</param> public Level(Engine engine, string mapPath) : base(engine) { mapFilePath = mapPath; Enemies = new List<Enemy>(); Lights = new List<EffectLight>(); levelParticleEffects = new List<ParticleEffectComponent>(); DrawOrder = (int)Global.Layers.Background; Engine.AddComponent(this); }
public ParticleEffectComponent(Engine engine, string effectName, Vector2 initialPosition) : base(engine) { DrawParticleEffect = true; particleEffectName = effectName; this.Position = initialPosition; particleEffect = Engine.Content.Load<ParticleEffect>(@"ParticleEffects\" + particleEffectName); particleEffect.LoadContent(Engine.Content); particleEffect.Initialise(); DrawOrder = int.MaxValue - 1; Engine.AddComponent(this); }
/// <summary> /// Constructs a new instance of krypton /// </summary> /// <param name="game">Your game object</param> /// <param name="effectAssetName">The asset name of Krypton's effect file, which must be included in your content project</param> public KryptonEngine(Engine engine, string effectAssetName) : base(engine) { this.mEffectAssetName = effectAssetName; }
public GravityLight(Engine engine, float gravityValue) : base(engine) { this.gravityValue = gravityValue; gravityVector = new Vector2(0.0f, gravityValue); }
public NullLight(Engine engine, List<EffectLight> worldLights) : base(engine) { WorldLights = worldLights; }
public MovingPlatformPhysicsComponent(Engine engine, List<Vector2> gameWorldPositionList, float speed) : base(engine) { }
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); }