private void SetValue(int value) { #if NO_SECURITY m_value = value; #elif SIMPLE_SECURITY m_chiper.SetValue(value); // Save debug value #if UNITY_EDITOR m_debugValue = value; #endif #else int v1 = m_chiper.GetValue(); int v2 = m_chiperCmp.GetValue(); if (v1 != v2) { // Detected hacking string message = string.Format("[{0}] v1({1}) != v2({2})" , GetType().ToString() , v1 , v2); SecurityListener.OnHackDetect(message); } m_chiper.SetValue(value); m_chiperCmp.SetValue(value); // Save debug value #if UNITY_EDITOR m_debugValue = value; #endif #endif }
//--------------------------------------------------------------------- // Get / Set Secure Value //--------------------------------------------------------------------- #region Get / Set Secure Value private int GetValue() { #if NO_SECURITY return(m_value); #elif UNITY_EDITOR int value = m_chiper.GetValue(); // Self error check if (value != m_debugValue) { string message = string.Format("[{0}] Dec({1}) != DebugV({2})" , GetType().ToString() , value , m_debugValue); SecurityListener.OnError(message); } return(value); #else return(m_chiper.GetValue()); #endif }