private void MouseControlOverObjects()
{
Cursor cursor = GuiManager.Cursor;
if (cursor.WindowOver != null)
{
return;
}
GuiManager.Cursor.StaticPosition = false;
#region moving mEditorLogic.CurrentEmitter and its boundary
if (AppState.Self.CurrentEmitter != null)
{
#region see if we pushed the mouse buttons on a marker
if (cursor.PrimaryPush || cursor.SecondaryPush)
{
if (cursor.WindowOver == null)
{
if (cursor.IsOn(EditorData.EditorLogic.ReactiveHud.CurrentEmitterMarker))
mGrabbedObject = AppState.Self.CurrentEmitter;
else if (AppState.Self.CurrentEmitter.BoundedEmission)
{
foreach (AxisAlignedRectangle corner in EditorData.EditorLogic.ReactiveHud.CurrentEmitterBoundaryCorners)
{
if (cursor.IsOn<AxisAlignedRectangle>(corner))
{
mGrabbedObject = corner;
break;
}
}
}
}
}
#endregion
#region release emitter
if (cursor.PrimaryClick || cursor.SecondaryClick)
{
mGrabbedObject = null;
}
#endregion
#region move the emitter or its boundary if we have one grabbed
if (mGrabbedObject != null && GuiData.ToolsWindow.moveObject.IsPressed)
{
PositionedObjectMover.MouseMoveObject(mGrabbedObject, MovementStyle.Hierarchy);
if (mGrabbedObject is AxisAlignedRectangle)
{
for (int i = 0; i < EditorData.EditorLogic.ReactiveHud.CurrentEmitterBoundaryCorners.Count; i++)
{
if (EditorData.EditorLogic.ReactiveHud.CurrentEmitterBoundaryCorners[i].Equals(mGrabbedObject))
{
AppState.Self.CurrentEmitter.EmissionBoundary.SetPoint(i, mGrabbedObject.X - AppState.Self.CurrentEmitter.X, mGrabbedObject.Y - AppState.Self.CurrentEmitter.Y);
if (i == 0)
{
AppState.Self.CurrentEmitter.EmissionBoundary.SetPoint(AppState.Self.CurrentEmitter.EmissionBoundary.Points.Count - 1,
mGrabbedObject.X - AppState.Self.CurrentEmitter.X, mGrabbedObject.Y - AppState.Self.CurrentEmitter.Y);
}
}
}
}
}
#endregion
}
#endregion
#region scnFileArray logic for moving our scene
if (EditorData.Scene != null && mGrabbedObject == null)
{
#region grabbing a sprite
if (cursor.PrimaryPush)
{
if (cursor.WindowOver == null)
{
if (cursor.GetSpriteOver(EditorData.Scene.Sprites) != null)
arrayGrabbed = true;
}
}
#endregion
#region release sprite
if (cursor.PrimaryClick)
arrayGrabbed = false;
#endregion
#region if an array is grabbed, move the entire scene by the sprite's velocity
if (arrayGrabbed && GuiData.ToolsWindow.moveObject.IsPressed)
{
EditorData.Scene.Shift(
new Vector3(
cursor.ActualXVelocityAt(0),
cursor.ActualYVelocityAt(0),
0));
}
#endregion
}
#endregion
if (GuiData.ToolsWindow.attachObject.IsPressed && cursor.PrimaryClick)
TryAttachEmitterToSprite();
}