コード例 #1
0
    public void collidedWith(Collider2D collider)
    {
        if (collider.tag != "Obstacle" && collider.tag != "Platform")
        {
            Hurtbox hurtbox = collider.GetComponent <Hurtbox>();
            hurtbox.ApplyAttack(damage);
        }

        if (projectileOnHitClip != null)
        {
            droneAudioSource.volume = SoundManager.Instance.DroneProjectileOnHitVolume;
            SoundManager.Instance.PlayWithRandomizedPitch(droneAudioSource, projectileOnHitClip);
        }

        thisProjectile.velocity = Vector2.zero;
        hitbox.EndCheckCollisions(); //We don't want to continue collision detecting for hits once the particle has hit an obstacle and is playing the destroy animation
        animator.Play(destroyAnimationClipName);
    }