private KeystrokeResult HandleDirection(Direction d) { if (m_chordKeystroke == ChordKeystrokeStatus.Operate) m_engine.Operate(d); else if (m_chordKeystroke == ChordKeystrokeStatus.Attack) m_engine.PlayerAttack(d); else if (m_chordKeystroke == ChordKeystrokeStatus.RangedAttack) { Point newSelection = PointDirectionUtils.ConvertDirectionToDestinationPoint(m_engine.TargetSelection, d); if (m_targetSelectionAllowable == null || m_targetSelectionAllowable(newSelection)) { m_engine.TargetSelection = newSelection; } return KeystrokeResult.InRangedAttack; } else m_engine.MovePlayer(d); m_chordKeystroke = ChordKeystrokeStatus.None; return KeystrokeResult.Action; }
public DefaultKeystrokeHandler(IGameEngine engine) { m_engine = engine; m_chordKeystroke = ChordKeystrokeStatus.None; }
private KeystrokeResult Attack() { m_chordKeystroke = ChordKeystrokeStatus.Attack; return KeystrokeResult.InAttack; }
private KeystrokeResult RangedAttack() { if (m_chordKeystroke == ChordKeystrokeStatus.RangedAttack) { m_engine.PlayerAttack(m_engine.TargetSelection); m_engine.SelectingTarget = false; m_chordKeystroke = ChordKeystrokeStatus.None; return KeystrokeResult.Action; } else { m_chordKeystroke = ChordKeystrokeStatus.RangedAttack; m_engine.TargetSelection = m_engine.Player.Position; m_engine.SelectingTarget = true; m_targetSelectionAllowable = p => (PointDirectionUtils.LatticeDistance(p, m_engine.Player.Position) <= 4); return KeystrokeResult.InRangedAttack; } }
private KeystrokeResult Operate() { m_chordKeystroke = ChordKeystrokeStatus.Operate; return KeystrokeResult.InOperate; }