Skip to content

Instantly share code, notes, and snippets.

@zeyangl
Created September 8, 2016 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeyangl/ec66614032b0bb59a630f5def7cc619c to your computer and use it in GitHub Desktop.
Save zeyangl/ec66614032b0bb59a630f5def7cc619c to your computer and use it in GitHub Desktop.
private struct ProcessIndex : System.IEquatable<ProcessIndex>
{
public Segment seg;
public int i;
public bool Equals(ProcessIndex other)
{
return this.seg == other.seg && this.i == other.i;
}
public override bool Equals(object other)
{
if(other is ProcessIndex)
return Equals((ProcessIndex)other);
return false;
}
public override int GetHashCode()
{
int hash = 23;
hash = hash * 31 + (int)seg;
hash = hash * 31 + i;
return hash;
}
}
...
public enum Segment : int
{
Update = 0,
FixedUpdate = 1,
LateUpdate = 2,
SlowUpdate = 3,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment