private void Grenade_OnTimeout(Grenade sender, Vector2 position) { //Remember to remove event registations or the GC will not collect it. sender.OnTimeout -= Grenade_OnTimeout; //Remove from update/drawing list _grenades.Remove(sender); }
private void HandleMouseInput(InputState input) { if (input.LastMouseState.RightButton == ButtonState.Released && input.CurrentMouseState.RightButton == ButtonState.Pressed) { Vector2 point = new Vector2(input.CurrentMouseState.X, input.CurrentMouseState.Y); Grenade grenade = new Grenade(point, PhysicsSimulator); grenade.Load(_grenadeTexture); grenade.OnTimeout += Grenade_OnTimeout; _grenades.Add(grenade); } if (input.CurrentMouseState.LeftButton == ButtonState.Pressed) { Vector2 point = new Vector2(input.CurrentMouseState.X, input.CurrentMouseState.Y); _hairDryer.Position = point; } }
void Grenade_OnTimeout(Grenade sender, Vector2 position) { ApplyExplosion(position); }
private void HandleMouseInput(InputState input) { if (input.LastMouseState.RightButton == ButtonState.Released && input.CurrentMouseState.RightButton == ButtonState.Pressed) { Vector2 point = new Vector2(input.CurrentMouseState.X, input.CurrentMouseState.Y); Grenade grenade = new Grenade(point, PhysicsSimulator); grenade.Load(_grenadeTexture); grenade.OnTimeout += Grenade_OnTimeout; _grenades.Add(grenade); } if (input.CurrentMouseState.LeftButton == ButtonState.Pressed) { Vector2 point = new Vector2(input.CurrentMouseState.X, input.CurrentMouseState.Y); _hairDryer.Position = point; } }
private void Grenade_OnTimeout(Grenade sender, Vector2 position) { //Remember to remove event registations or the GC will not collect it. sender.OnTimeout -= Grenade_OnTimeout; //Remove from update/drawing list _grenades.Remove(sender); }
void Grenade_OnTimeout(Grenade sender, Vector2 position) { ApplyExplosion(position); }