public static int GetStateHash() { int hash = LSUtility.PeekRandom(int.MaxValue); hash += 1; hash ^= AgentController.GetStateHash(); hash += 1; hash ^= ProjectileManager.GetStateHash(); hash += 1; return(hash); }
public static int GetStateHash() { int operationToggle = 0; int hash = LSUtility.PeekRandom(int.MaxValue); for (int i = 0; i < PeakGlobalID; i++) { if (GlobalAgentActive[i]) { RTSAgent agent = GlobalAgents[i]; int n1 = agent.Body._position.GetHashCode() + agent.Body._rotation.GetHashCode(); switch (operationToggle) { case 0: hash ^= n1; break; case 1: hash += n1; break; default: hash ^= n1 * 3; break; } operationToggle++; if (operationToggle >= 2) { operationToggle = 0; } } } return(hash); }