using System.Collections; using System.Collections.Generic; using UnityEngine; public static class Vector2IntExtensions { public static Vector2Int Rotate(this Vector2Int v, float degrees) { float sin = Mathf.Sin(degrees * Mathf.Deg2Rad); float cos = Mathf.Cos(degrees * Mathf.Deg2Rad); float tx = v.x; float ty = v.y; float x = (cos * tx) - (sin * ty); float y = (sin * tx) + (cos * ty); return new Vector2Int(Mathf.RoundToInt(x), Mathf.RoundToInt(y)); } }