private void move()
 {
     if (mouse.Equals(selection))
     {
         unselect();
     }
     else if (!mouse.containsKey("Unit"))
     {
         if (path.Length > 0)
         {
             waiting = true;
             HexPosition.clearSelection();
             selection = mouse;
             selection.select("Selection");
             CmdMoveUnit(HexPosition.pathToIntString(path));
         }
     }
     else
     {
         object enemy = null;
         if (mouse.tryGetValue("Unit", out enemy))
         {
             if (isAttackable(selection.getUnit(), (Unit)enemy))
             {
                 actuallyAttack();
             }
         }
     }
 }
示例#2
0
 private void move()
 {
     if (mouse.Equals(selection))
     {
         unselect();
     }
     else if (!mouse.containsKey("Unit"))
     {
         if (path.Length > 0)
         {
             Unit myUnit = selection.getUnit();
             myUnit.move(path);
             HexPosition.clearSelection();
             selection = mouse;
             selection.select("Selection");
             if (selectAttackable(myUnit))
             {
                 phase = Phase.ATTACK;
             }
             else
             {
                 myUnit.skipAttack();
                 unselect();
             }
         }
     }
 }
示例#3
0
 private void move()
 {
     if (mouse.Equals(selection))
     {
         unselect();
     }
     else if (!mouse.containsKey("Unit"))
     {
         if (path.Length > 0)
         {
             Unit myUnit = ((Unit)selection.getValue("Unit"));
             myUnit.move(path);
             HexPosition.clearSelection();
             selection = mouse;
             selection.select("Selection");
             if (selectAttackable(myUnit))
             {
                 turn = Turn.ATTACK;
             }
             else
             {
                 myUnit.Status = Unit.State.WAIT;
                 unselect();
                 endTurn();
             }
         }
     }
     else
     {
         object enemy = null;
         if (mouse.tryGetValue("Unit", out enemy))
         {
             Unit myUnit = ((Unit)selection.getValue("Unit"));
             if (isAttackable(myUnit, (Unit)enemy))
             {
                 actuallyAttack();
             }
         }
     }
 }
示例#4
0
 private void move()
 {
     if (mouse.Equals(selection))
     {
         unselect();
     }
     else if (!mouse.containsKey("Unit"))
     {
         if (path.Length > 0)
         {
             Unit myUnit = selection.getUnit();
             myUnit.move(path);
             HexPosition.clearSelection();
             selection = mouse;
             selection.select("Selection");
             if (selectAttackable(myUnit))
             {
                 turn = Turn.ATTACK;
             }
             else
             {
                 myUnit.skipAttack();
                 unselect();
             }
         }
     }
     else
     {
         Unit enemy = mouse.getUnit();
         if (enemy != null)
         {
             Unit myUnit = selection.getUnit();
             if (isAttackable(myUnit, enemy))
             {
                 actuallyAttack();
             }
         }
     }
 }
    /*public override bool Equals (object obj) {
     *      if (obj.GetType is HexEntry) {
     *              HexEntry entry = (HexEntry) obj;
     *              return Position == entry.Position && Name == entry.Name;
     *      } else {
     *              return false;
     *      }
     * }*/

    public bool Equals(HexaUnit hexaUnit)
    {
        return(position.Equals(hexaUnit.Position) && name == hexaUnit.Name);
    }
示例#6
0
    /*public override bool Equals (object obj) {
     *          if (obj.GetType is HexEntry) {
     *                  HexEntry entry = (HexEntry) obj;
     *                  return Position == entry.Position && Name == entry.Name;
     *          } else {
     *                  return false;
     *          }
     *  }*/

    public bool Equals(HexEntry hexEntry)
    {
        return(position.Equals(hexEntry.Position) && name == hexEntry.Name);
    }