Beispiel #1
0
        public static Direction FromVector(Vector2I v)
        {
            v = v.Normalized;
            if (v.Equals(-Vector2I.UnitY))
            {
                return(North);
            }
            if (v.Equals(Vector2I.UnitY))
            {
                return(South);
            }
            if (v.Equals(Vector2I.UnitX))
            {
                return(East);
            }
            if (v.Equals(-Vector2I.UnitX))
            {
                return(West);
            }

            return(North);
        }
Beispiel #2
0
		public static Direction FromVector(Vector2I v)
		{
			v = v.Normalized;
			if (v.Equals(-Vector2I.UnitY))
			{
				return North;
			}
			if (v.Equals(Vector2I.UnitY))
			{
				return South;
			}
			if (v.Equals(Vector2I.UnitX))
			{
				return East;
			}
			if (v.Equals(-Vector2I.UnitX))
			{
				return West;
			}

			return North;
		}