HandleEvent() public method

public HandleEvent ( GameObject in_gameObject ) : void
in_gameObject GameObject
return void
Exemplo n.º 1
0
    public BulletAttack Fire(string tag)
    {
        if (akAmbient != null)
        {
            akAmbient.HandleEvent(null);
        }

        var cannonVelocity = (transform.position - _prevPosition) / Time.deltaTime;

        var bulletInstance = Instantiate(bulletPrefab, _muzzle.position, _muzzle.rotation) as BulletAttack;

        bulletInstance.tag = tag;
        var bulletRigidbody = bulletInstance.GetComponent <Rigidbody>();

        bulletRigidbody.velocity        = _muzzle.transform.forward * bulletInstance.initSpeed;// + cannonVelocity;
        bulletInstance.transform.parent = null;
        ChangeLayersRecursively(bulletInstance.transform, tag + "Bullet");
        StartParticle();
        return(bulletInstance);
    }