mirror of
https://github.com/ConjureETS/Labo_2_equ_2_a15.git
synced 2026-03-24 01:21:07 +00:00
24 lines
500 B
C#
24 lines
500 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class BombPickup : MonoBehaviour
|
|
{
|
|
public AudioClip audioPickup;
|
|
|
|
void OnTriggerEnter2D (Collider2D other)
|
|
{
|
|
// If the player enters the trigger zone...
|
|
if(other.tag == "Player")
|
|
{
|
|
AudioSource.PlayClipAtPoint(audioPickup, transform.position);
|
|
|
|
// Increase the number of bombs the player has.
|
|
other.GetComponent<LayBombs>().bombCount++;
|
|
|
|
// Destroy the crate.
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
}
|
|
}
|