Beispiel #1
0
    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));
    }
Beispiel #2
0
    private void OnUpdateBulletIndex(CBulletNew bullet)
    {
        int index = this._bulletList.IndexOf(bullet);

        this._index = index;
    }