private UnitModel ShootingTarget(BattlefieldVision vision) { for (int i = 1; i <= _maxShootingDistance; i++) { var pos = new MyHexPosition(i, 0); if (!vision.HasTileAt(pos)) { return(null); } var otherUnitAtFront = vision.GetUnitAt(pos); if (otherUnitAtFront != null) { if (otherUnitAtFront.Owner != vision.PossesedPawn.Owner) { return(otherUnitAtFront); } else { return(null); } } } return(null); }
private UnitModel RetriveGrabbedUnit(BattlefieldVision vision) { for (int i = MinDragDistance; i <= MaxDragDistance; i++) { var pos = new MyHexPosition(i, 0); if (!vision.HasTileAt(pos)) { return(null); } var otherUnitAtFront = vision.GetUnitAt(pos); if (otherUnitAtFront != null) { if (otherUnitAtFront.Owner != vision.PossesedPawn.Owner) { return(otherUnitAtFront); } else { return(null); } } } return(null); }