public void MouseDownEvent(Vector2 screenCoordinates, InputManager.MouseButton button)
        {
            if (_isActive)
            {
                if (button == InputManager.MouseButton.Left)
                {
                    ParticleActor oneOff = (ParticleActor)ActorFactory.Instance.CreateActor("particle_demo", null, 0, null);
                    oneOff.Color = new Color(0.0f, 0.0f, 1.0f);
                    oneOff.SetSprite("Images/triangle");
                    //We can set the position to where the mouse click happened.
                    oneOff.Position = World.Instance.Camera.ScreenToWorld((int)screenCoordinates.X, (int)screenCoordinates.Y);

                    //The system will remove itself from the world and deallocate its memory
                    //  when the lifetime ends. (If it's 0.0, it's assumed to be infinite.)
                    oneOff.SystemLifetime = 1.0f;

                    //Make sure to add it to the world!
                    World.Instance.Add(oneOff);
                }
                else if (button == InputManager.MouseButton.Right)
                {
                    int currColorIndex = particleColors.IndexOf(pa.Color) - 1;
                    if (currColorIndex < 0) { currColorIndex = particleColors.Count - 1; }
                    pa.Color = particleColors[currColorIndex];
                }
                else if (button == InputManager.MouseButton.Middle)
                {
                    pa.Color = particleColors.First();
                }
            }
        }
 public void MouseDownEvent(Vector2 screenCoordinates, InputManager.MouseButton button)
 {
     if (_mf != null && button == InputManager.MouseButton.Left)
     {
         Vector2 worldCoords = World.Instance.Camera.ScreenToWorld((int)screenCoordinates.X, (int)screenCoordinates.Y);
         _mf.GoTo(worldCoords);
     }
 }
Ejemplo n.º 3
0
 public void MouseDownEvent(Vector2 screenCoordinates, InputManager.MouseButton button)
 {
     Selected  = World.Instance.FindAt((int)screenCoordinates.X, (int)screenCoordinates.Y) as Actor;
     if (Selected != null)
     {
         Vector2 worldCoordinates = World.Instance.Camera.ScreenToWorld((int)screenCoordinates.X, (int)screenCoordinates.Y);
         _HeldOffset = Selected.Position - worldCoordinates;
         _bObjectHeld = true;
     }
     else
     {
         _bCameraHeld = true;
         _screenHeldPosition = screenCoordinates;
         _cameraHeldPosition = World.Instance.Camera.Position;
     }
 }
 public void MouseUpEvent(Vector2 screenCoordinates, InputManager.MouseButton button)
 {
 }
Ejemplo n.º 5
0
 private void registerButtonPress(ButtonState state, InputManager.GamePadButton button)
 {
     if (state == ButtonState.Pressed)
     {
         InputManager.Instance.OnButtonDown(button);
     }
     else
     {
         InputManager.Instance.OnButtonUp(button);
     }
 }
Ejemplo n.º 6
0
 public void MouseUpEvent(Vector2 screenCoordinates, InputManager.MouseButton button)
 {
     _bObjectHeld = false;
     _bCameraHeld = false;
 }