Example #1
0
    IEnumerator LifetimeCountdown()
    {
        // Once the bounce time is over, freeze in place
        yield return(new WaitForSeconds(grenadeFreezeDelay));

        Rigidbody rb = GetComponent <Rigidbody>();

        rb.constraints = RigidbodyConstraints.FreezeAll;

        // Then once the explosion timer runs out, explode
        yield return(new WaitForSeconds(grenadeExplosionDelay));

        // Tell our gun that we are despawning
        if (gun)
        {
            gun.DespawnGrenade();
        }
        ExplosionDamage(transform.position, blastRadius);
        PhotonNetwork.Destroy(gameObject);
    }