public virtual void Click(MouseEventArgs e, bool accumulate) { #region Sanity checks if (e == null) { throw new ArgumentNullException(nameof(e)); } #endregion // Determine the Engine object the user clicked on DoubleVector3 intersectPosition; var pickedObject = View.Pick(e.Location, out intersectPosition); if (pickedObject == null) { return; } switch (e.Button) { case MouseButtons.Left: if (pickedObject is Terrain) { // Action: Left-click on terrain to select one nearby entity PickPositionables( Universe.Positionables.OfType <Entity>().Where(entity => entity.CollisionTest(intersectPosition.Flatten())).Take(1).Cast <Positionable <Vector2> >(), accumulate); } else { // Action: Left-click on entity to select it try { PickPositionables(new[] { RenderablesSync.Lookup(pickedObject) }, accumulate); } catch (KeyNotFoundException) {} } break; case MouseButtons.Right: if (SelectedPositionables.Count != 0 && pickedObject is OmegaEngine.Graphics.Renderables.Terrain) { // Action: Right-click on terrain to move // Depending on the actual presenter type this may invoke pathfinding or teleportation MovePositionables(SelectedPositionables, intersectPosition.Flatten()); } break; } }