private void HandleRangedSinglePointInvoke(OnTargettingPointSelected selectionDelegate, List<EffectivePoint> targetablePoints) { m_engine.Targetting.FilterNotTargetableToPlayerPointsFromList(targetablePoints, true); m_engine.Targetting.FilterNotVisibleToPlayerBothWaysFromList(targetablePoints, true); OnTargetSelect onSelection = (window, engine, point) => { if (point != m_engine.Player.Position) selectionDelegate(point); }; TargettingModeKeyboardHandler handler = new TargettingModeKeyboardHandler(TargettingModeKeyboardHandler.TargettingType.Monster, m_engine, m_map, onSelection, targetablePoints); m_window.SetKeyboardHandler(handler.OnKeyboardDown); }
private void HandleInvoke(TargetingInfo targetInfo, OnTargettingPointSelected onInvoke, object invokingObject) { if (targetInfo == null) { onInvoke(m_engine.Player.Position); m_window.UpdateWorld(); } else { switch (targetInfo.Type) { case TargetingInfo.TargettingType.Stream: { List<EffectivePoint> targetablePoints = PointListUtils.EffectivePointListOneStepAllDirections(m_engine.Player.Position); HandleRangedSinglePointInvoke(onInvoke, targetablePoints); break; } case TargetingInfo.TargettingType.RangedSingle: case TargetingInfo.TargettingType.RangedBlast: case TargetingInfo.TargettingType.RangedExplodingPoint: { List<EffectivePoint> targetablePoints = PointListUtils.EffectivePointListFromBurstPosition(m_engine.Player.Position, targetInfo.Range); HandleRangedSinglePointInvoke(onInvoke, targetablePoints); break; } case TargetingInfo.TargettingType.Cone: { MageCrawlPoint playerPosition = m_engine.Player.Position; List<EffectivePoint> targetablePoints = GetConeTargetablePoints(playerPosition); OnTargetSelect selectionDelegate = (w, e, p) => { if (p != m_engine.Player.Position) onInvoke(p); }; TargettingModeKeyboardHandler handler = new TargettingModeKeyboardHandler(TargettingModeKeyboardHandler.TargettingType.Monster, m_engine, m_map, selectionDelegate, targetablePoints); m_window.SetKeyboardHandler(handler.OnKeyboardDown); break; } case TargetingInfo.TargettingType.Self: { onInvoke(m_engine.Player.Position); m_window.UpdateWorld(); break; } default: throw new System.InvalidOperationException("InvokingKeystrokeHandler - HandleInvoke, don't know how to handle: " + targetInfo.Type.ToString()); } } }