MIF_E31222344/Malukuu/Assets/Script/button_animation.cs

25 lines
556 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class button_animation : MonoBehaviour
{
public AudioClip buttonTouchSound; // Suara button touch yang bisa ditambahkan sendiri
private AudioSource audioSource;
void Start()
{
audioSource = GetComponent<AudioSource>();
}
public void button_touch()
{
GetComponent<Animation>().Play("Button_Touch");
if (buttonTouchSound != null)
{
audioSource.PlayOneShot(buttonTouchSound);
}
}
}