コード例 #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();
            }
        }