Created
October 20, 2016 22:18
-
-
Save jbevain/8b10f1ee73ead7161ac5b1b2d9005287 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
struct Vector3 | |
{ | |
public float X, Y, Z; | |
public static bool operator true(Vector3 v) | |
{ | |
return v.X != 0 && v.Y != 0 && v.Z != 0; | |
} | |
public static bool operator false(Vector3 v) | |
{ | |
return v.X == 0 && v.Y == 0 && v.Z == 0; | |
} | |
public static bool operator !(Vector3 v) | |
{ | |
return v.X == 0 && v.Y == 0 && v.Z == 0; | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var id = new Vector3 { X = 1, Y = 1, Z = 1 }; | |
var zero = new Vector3(); | |
if (id) Console.WriteLine("id is true"); | |
if (!zero) Console.WriteLine("zero is false"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment