2015-11-30 18:25:48 -05:00

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);
}
}
}