Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public virtual Rectangle GetAttackArea(Direction direction, int radius) {
  2. var area = new Rectangle(game.PlayerLocation, new Size(radius, radius));
  3. // center
  4. area.Left -= radius / 2;
  5. area.Top -= radius / 2;
  6.  
  7. // extend
  8. switch (direction) {
  9. case Direction.Up: area.Top -= radius; area.Height += radius; break;
  10. case Direction.Left: area.Left -= radius; area.Width += radius; break;
  11. case Direction.Down: area.Bottom += radius; area.Height += radius; break;
  12. case Direction.Right: area.Right += radius; area.Width += radius; break;
  13. }
  14. return area;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement