Пример #1
0
 private void OnDestroy()
 {
     this.simulator.OnDestroy();
     if (Instance == this)
     {
         Instance = null;
     }
 }
Пример #2
0
        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();
        }
Пример #3
0
 public static RVOSimulator GetInstance()
 {
     if (Instance == null)
     {
         RVOSimulator simulator = UnityEngine.Object.FindObjectOfType <RVOSimulator>();
         if (simulator != null)
         {
             simulator.Awake();
         }
     }
     return(Instance);
 }
Пример #4
0
 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;
     }
 }