Exemplo n.º 1
0
    void FixedUpdate()
    {
        distance   += (transform.position - oldPosition).magnitude;
        oldPosition = transform.position;

        if (distance > stepDistance)
        {
            distance = 0;
            source.RandomizePitch(randomPitchRange);
            source.PlayOneShot(stepSound);
        }
    }
    protected override void Break()
    {
        transform.parent          = null;
        rb.isKinematic            = false;
        rb.useGravity             = true;
        rb.collisionDetectionMode = CollisionDetectionMode.Continuous;
        gameObject.layer          = brokenLayer;
        StartCoroutine(ApplyBreakMovement());

        if (source != null)
        {
            source.RandomizePitch(randomPitchRadius);
            source.PlayOneShot(breakSound);
        }

        Destroy(this);
    }
 public void Fire()
 {
     source.RandomizePitch(randomPitchRange);
     source.PlayOneShot(fireClip);
 }