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]) { LSAgent agent = GlobalAgents [i]; int n1 = agent.Body._position.GetStateHash() + agent.Body._rotation.GetStateHash(); switch (operationToggle) { case 0: hash ^= n1; break; case 1: hash += n1; break; default: hash ^= n1 * 3; break; } operationToggle++; if (operationToggle >= 2) { operationToggle = 0; } if (agent.Body.IsNotNull()) { hash ^= agent.Body._position.GetStateHash(); hash ^= agent.Body._position.GetStateHash(); } } } return(hash); }