Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace fCraft
- {
- public enum Direction
- {
- Null,
- one,
- two,
- three,
- four
- }
- public class DirectionFinder
- {
- public static Direction GetDirection(Vector3I[] marks)
- {
- if (Math.Abs(marks[1].X - marks[0].X) > Math.Abs(marks[1].Y - marks[0].Y))
- {
- if (marks[0].X < marks[1].X)
- {
- return Direction.one;
- }
- else
- {
- return Direction.two;
- }
- }
- else if (Math.Abs(marks[1].X - marks[0].X) < Math.Abs(marks[1].Y - marks[0].Y))
- {
- if (marks[0].Y < marks[1].Y)
- {
- return Direction.three;
- }
- else
- {
- return Direction.four;
- }
- }
- else
- return Direction.Null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement