private void Awake() { if (Init(instance, COMPONENT_NAME)) { instance = this; } }
protected static void SetupDetectorInScene(string detectorName) { SpeedHackDetector component = (SpeedHackDetector)FindObjectOfType(typeof(SpeedHackDetector)); if (component != null) { if (component.IsPlacedCorrectly(detectorName)) { if (UnityEditor.EditorUtility.DisplayDialog("Remove " + detectorName + "?", detectorName + " already exists in scene and placed correctly. Dou you wish to remove it?", "Yes", "No")) { DestroyImmediate(component.gameObject); } } else if (component.MayBePlacedHere()) { int dialogResult = UnityEditor.EditorUtility.DisplayDialogComplex("Fix existing Game Object to work with " + detectorName + "?", detectorName + " already exists in scene and placed onto empty Game Object \"" + component.name + "\".\nDo you wish to let component configure and use this Game Object further? Press Delete to remove component from scene at all.", "Fix", "Delete", "Cancel"); switch (dialogResult) { case 0: component.FixCurrentGameObject(detectorName); break; case 1: DestroyImmediate(component); break; } } else { int dialogResult = UnityEditor.EditorUtility.DisplayDialogComplex("Move existing " + detectorName + " to own Game Object?", "Looks like " + detectorName + " component already exists in scene and placed incorrectly on Game Object \"" + component.name + "\".\nDo you wish to let component move itself onto separate configured Game Object \"" + detectorName + "\"? Press Delete to remove plugin from scene at all.", "Move", "Delete", "Cancel"); switch (dialogResult) { case 0: GameObject go = new GameObject(detectorName); SpeedHackDetector newComponent = go.AddComponent <SpeedHackDetector>(); UnityEditor.EditorUtility.CopySerialized(component, newComponent); DestroyImmediate(component); break; case 1: DestroyImmediate(component); break; } } } else { GameObject go = new GameObject(detectorName); go.AddComponent <SpeedHackDetector>(); } }
private void Awake() { if (!IsPlacedCorrectly()) { Debug.LogWarning("[ACT] Speed Hack Detector is placed in scene incorrectly and will be auto-destroyed! Please, use \"GameObject->Create Other->Code Stage->Anti-Cheat Toolkit->Speed Hack Detector\" menu to correct this!"); UnityEngine.Object.Destroy(this); } else { instance = this; UnityEngine.Object.DontDestroyOnLoad(base.gameObject); } }
private void DisposeInternal() { StopMonitoringInternal(); instance = null; UnityEngine.Object.Destroy(base.gameObject); }
protected override void DisposeInternal() { base.DisposeInternal(); instance = null; }
public static void StartDetection(UnityAction callback, float interval, byte maxFalsePositives) { SpeedHackDetector.StartDetection(callback, interval, maxFalsePositives, SpeedHackDetector.GetOrCreateInstance.coolDown); }
public static void StartDetection(UnityAction callback) { SpeedHackDetector.StartDetection(callback, SpeedHackDetector.GetOrCreateInstance.interval); }