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;
- using UnityEngine;
- namespace Medvedya.FOR2D
- {
- [System.Serializable]
- public struct Vector2int
- {
- public int X;
- public int Y;
- public static Vector2int UP { get { return new Vector2int(0, 1); } }
- public static Vector2int DOWN { get { return new Vector2int(0, -1); } }
- public static Vector2int LEFT { get { return new Vector2int(-1, 0); } }
- public static Vector2int RIGHT { get { return new Vector2int(1, 0); } }
- public static Vector2int ZERO { get { return new Vector2int(0, 0); } }
- public static Vector2int[] allDirections = { UP, RIGHT, DOWN, LEFT };
- public Vector2int(int x, int y)
- {
- X = x;
- Y = y;
- }
- public static Vector2int operator +(Vector2int v1, Vector2int v2)
- {
- return new Vector2int(v1.X + v2.X, v1.Y + v2.Y);
- }
- public static Vector2int operator -(Vector2int v1, Vector2int v2)
- {
- return new Vector2int(v1.X - v2.X, v1.Y - v2.Y);
- }
- public static Vector2int operator *(Vector2int v1, int intValue)
- {
- return new Vector2int(v1.X * intValue, v1.Y * intValue);
- }
- public static Vector2int operator *(int intValue, Vector2int v1)
- {
- return v1 * intValue;
- }
- public static Vector2 operator *(Vector2int v1, float floatValue)
- {
- return new Vector2(v1.X * floatValue, v1.Y * floatValue);
- }
- public static Vector2 operator *(float floatValue, Vector2int v1)
- {
- return v1 * floatValue;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement