OldBlueWater/BlueWater/Assets/Blobcreate/Projectile Toolkit/Demos/Scripts/02 Battle Pro Max/WeaponPack.cs
2023-08-10 17:23:04 +09:00

24 lines
477 B
C#

using UnityEngine;
namespace Blobcreate.ProjectileToolkit.Demo
{
public class WeaponPack : MonoBehaviour
{
public Transform gunPrefab;
public GameObject enemy;
public AudioSource pickupSound;
void OnTriggerEnter(Collider other)
{
var gunPoint = other.transform.GetChild(0).Find("GunPoint");
if (gunPoint != null)
{
Instantiate(gunPrefab, gunPoint);
gameObject.SetActive(false);
enemy.SetActive(true);
pickupSound.Play();
}
}
}
}