Ejemplo n.º 1
0
    public Shell Fire()
    {
        Transform thisBarrel  = barrel;
        Transform thisEmitter = emitter;

        if (barrel2 != null)
        {
            if (barrel2IsNext)
            {
                thisBarrel  = barrel2;
                thisEmitter = emitter2;
            }
        }
        Shell currentShell = Instantiate(shell, thisEmitter.position, thisEmitter.rotation);

        currentShell.ApplyForce(launchVelocity);
        Destroy(currentShell.gameObject, 10f);

        rigidbody.AddExplosionForce(explosionForce, explosionPoint.position, 100f, explosionLift);
        if (barrel != null)
        {
            thisBarrel.localScale = new Vector3(thisBarrel.localScale.x, thisBarrel.localScale.y, thisBarrel.localScale.z * 0.7f);
            barrel2IsNext         = !barrel2IsNext;
        }
        return(currentShell);
    }
Ejemplo n.º 2
0
    public Shell Fire(float launchVelocity, Shell shell)
    {
        Shell currentShell = Instantiate(shell, emitters[currentBarrel].position, emitters[currentBarrel].rotation);

        currentShell.ApplyForce(launchVelocity);
        Destroy(currentShell.gameObject, 10f);
        ApplyFireSettings();
        return(currentShell);
    }