/// <summary> /// Creates new obstacle sprite /// </summary> /// <param name="velocity">Initial velocity of obstacle</param> /// <param name="position">Initial position of obstacle</param> /// <param name="graphics">The graphics device</param> public ObstacleSprite(Vector2 velocity, Vector2 position, GraphicsDevice graphics, Game game) { this.Velocity = velocity; this.Position = position; this.graphics = graphics; this.bounds = new BoundingCircle(position + new Vector2(16, 16), 18); fire = new FireParticleSystem(game, this); game.Components.Add(fire); }
public FireObject(ContentManager content, FireParticleSystem fireSystem, SmokePlumeParticleSystem fireSmokeSystem, Vector3 firePosition, Vector3 smokeOffset) : base(firePosition, Color.Red.ToVector3(), 400) { this.fireSystem = fireSystem; this.fireSmokeSystem = fireSmokeSystem; fireEmitter = new ParticleEmitter(fireSystem, 100, firePosition); fireEmitter.Origin = firePosition; fireSmokeEmitter = new ParticleEmitter(fireSmokeSystem, 100, firePosition + smokeOffset); fireSmokeEmitter.Origin = firePosition + smokeOffset; this.smokeOffset = smokeOffset; Model = content.Load <Model>(@"Models\light"); }
//Maybe we should add later some methods like: Highlight, Select, and Reset. Just like the checker. //But that needs extra handling using dedicated Effect. public ChessModel(Game game, AbstractPiece logicalPieceRef, ModelProvider modelProvider) : base(game) { this.logicalPieceRef = logicalPieceRef; this.modelProvider = modelProvider; // ModelEffect = new PhongEffect(game, logicalPieceRef); ModelEffect = new BasicEffect(game.GraphicsDevice, null); //System.Console.WriteLine(ModelEffect.Effect.GetHashCode()); // ModelEffect.setOtherParams(); if (logicalPieceRef.player is Player1) { fireParticles = new FireParticleSystem(game, Tint.Dark); } else { fireParticles = new FireParticleSystem(game, Tint.Light); } fireParticles.DrawOrder = 500; cam = (GameCamera)game.Services.GetService(typeof(BasicCamera)); Game.Components.Add(fireParticles); shadowPlane = new Plane(new Vector3(-5, 0, -5), new Vector3(5, 0, -5), new Vector3(5, 0, 5)); shadowPlane.Normal = new Vector3(0, -8, 0); shadowLightDir = new Vector3(-2.1f, -2f, -2.1f); shadow = Matrix.CreateShadow(shadowLightDir, shadowPlane); modelEffect.LightingEnabled = true; modelEffect.TextureEnabled = true; modelEffect.EnableDefaultLighting(); if (logicalPieceRef.player is Player1) { texture = game.Content.Load <Texture2D>("White"); } else { texture = game.Content.Load <Texture2D>("Black"); } //game.Components.Add(fireParticles); }
public override void Initialize() { this.currentState = Flames.NORMAL; this.velocity = new Vector3(0, 0, 0); this.gravity = new Vector3(0, 0.00125f, 0); this.launchVelocity = new Vector3(0, 0.25f, 0); this.drag = 0.6f; this.maxVelocity = new Vector3(0.02f, -0.01f, 0.02f); this.velocityMultiplication = 1; this.leftThumbstickDeadzone = new Vector2(0.1f, 0.1f); this.spreadManager = new FireSpreadManager(this.game); this.Game.Components.Add(this.spreadManager); this.timeTillSpread = SPREADTIME; this.isKilled = false; //Particles. this.fireParticles = new FireParticleSystem(game, Game.Content); this.sparkParticles = new ParticleSpark(game, Game.Content); this.particles = this.fireParticles; this.Game.Components.Add(this.fireParticles); this.Game.Components.Add(this.sparkParticles); this.fireParticles.DrawOrder = 100; this.sparkParticles.DrawOrder = 100; //Sets the dimensions of the flame. flameSize = 200; minSize = 0; maxSize = 400; rnd = new Random(); sandSparkSizeMod = -0.7f; sandHeight = 7.8f; base.Initialize(); }
/// <summary> /// Handle the event when the mouse leaves the Fire button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MyButtonMouseLeave(object sender, MouseEventArgs e) { // Stop the particle system FireParticleSystem.Stop(); }
/// <summary> /// Handle the event when the mouse enters the Fire button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void MyButtonMouseEnter(object sender, MouseEventArgs e) { // Start the particle system FireParticleSystem.Start(); }