private void OnDestroy() { this.simulator.OnDestroy(); if (Instance == this) { Instance = null; } }
protected void FindSimulator() { RVOSimulator simulator = UnityEngine.Object.FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator; if (simulator == null) { throw new InvalidOperationException("No RVOSimulator could be found in the scene. Please add one to any GameObject"); } this.sim = simulator.GetSimulator(); }
public static RVOSimulator GetInstance() { if (Instance == null) { RVOSimulator simulator = UnityEngine.Object.FindObjectOfType <RVOSimulator>(); if (simulator != null) { simulator.Awake(); } } return(Instance); }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Instance.enabled = false; Instance = this; } if (this.simulator == null) { int workers = this.workerThreads; this.simulator = new Simulator(workers, this.doubleBuffering); this.simulator.Interpolation = this.interpolation; } }