Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public virtual Rectangle GetAttackArea(Direction direction, int radius) {
- var area = new Rectangle(game.PlayerLocation, new Size(radius, radius));
- // center
- area.Left -= radius / 2;
- area.Top -= radius / 2;
- // extend
- switch (direction) {
- case Direction.Up: area.Top -= radius; area.Height += radius; break;
- case Direction.Left: area.Left -= radius; area.Width += radius; break;
- case Direction.Down: area.Bottom += radius; area.Height += radius; break;
- case Direction.Right: area.Right += radius; area.Width += radius; break;
- }
- return area;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement