public void Spawn(Vector3 pos, Vector3 vel) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(this._bulletAsset, pos, Quaternion.identity); CBulletNew component = gameObject.GetComponent <CBulletNew>(); component.AddVel(vel); UnityEngine.Object.Destroy(gameObject, 8f); this._bulletList.Add(component); component.SubscribOnInst(new CBulletNew.BulletSpawn(this.OnUpdateBulletIndex)); }
private void OnUpdateBulletIndex(CBulletNew bullet) { int index = this._bulletList.IndexOf(bullet); this._index = index; }