i3e-asg2/Assets/Scripts/GiftBox.cs

21 lines
476 B
C#
Raw Normal View History

2024-06-06 18:13:39 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GiftBox : Interactable
{
[SerializeField]
GameObject collectableToSpawn;
[SerializeField]
AudioClip GiftBoxAudio;
public override void Interact()
{
AudioSource.PlayClipAtPoint(GiftBoxAudio, transform.position, 1f);
Instantiate(collectableToSpawn, transform.position, collectableToSpawn.transform.rotation);
base.Interact();
}
}