コード例 #1
0
 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;
 }
コード例 #2
0
 public DefaultKeystrokeHandler(IGameEngine engine)
 {
     m_engine = engine;
     m_chordKeystroke = ChordKeystrokeStatus.None;
 }
コード例 #3
0
 private KeystrokeResult Attack()
 {
     m_chordKeystroke = ChordKeystrokeStatus.Attack;
     return KeystrokeResult.InAttack;
 }
コード例 #4
0
 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;
     }
 }
コード例 #5
0
 private KeystrokeResult Operate()
 {
     m_chordKeystroke = ChordKeystrokeStatus.Operate;
     return KeystrokeResult.InOperate;
 }