Example #1
0
        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);
        }
Example #2
0
        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;
            }
        }
Example #3
0
 void Grenade_OnTimeout(Grenade sender, Vector2 position)
 {
     ApplyExplosion(position);
 }
Example #4
0
        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;
            }
        }
Example #5
0
        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);
        }
Example #6
0
 void Grenade_OnTimeout(Grenade sender, Vector2 position)
 {
     ApplyExplosion(position);
 }