I was trying to extend the Vector2 class and this signature below will do the magic:
Code: Select all
public static Vector2 Rotate(this Vector2 v, float degrees) {}
Code: Select all
public static Vector2 Rotate(this Vector2 v, float degrees) {}
I wanted to try anyway by assuming that, since there is a "global wrapper" inside the script section, it could be a static class, but I wasn't sure it could work since from the beginning.
that makes no sense but I don't see the point of fixing something when you're gaining nothing from it, fixing it still wouldn't let you implement extensions, so why bother lolJakSparro98 wrote: ↑Sun Jun 09, 2019 12:52 pmI wanted to try anyway by assuming that, since there is a "global wrapper" inside the script section, it could be a static class
Code: Select all
public static class V
{
public static void Rotate(ref Vector2 vector, float radians)
{
// Operations in here
}
}
...
Vector2 testy = Vector2.Zero;
V.Rotate(ref testy, 20f);