Пример #1
0
 public void NewAutoElectron(int num = 1)
 {
     for (int i = 0; i < num; i++)
     {
         Electron obj = Instantiate(ElectronPrefab, transform.GetChild(2)).GetComponent <Electron>();
         obj.PhysicsObj.AddForce(Random.insideUnitSphere); //inject some random offset
         obj.OnDeselect?.Invoke();
     }
 }
Пример #2
0
        /// <summary>
        /// create a new electron
        /// </summary>
        public void NewElectron()
        {
            GameObject obj = Instantiate(ElectronPrefab, transform.GetChild(2));

            Electron electron = obj.GetComponent <Electron>();

            if (electron != null)
            {
                electron.OnSelect?.Invoke();
            }
        }