25 lines
618 B
C#
25 lines
618 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class BtnTrigger : MonoBehaviour
|
|
{
|
|
public AudioSource Aud_Btn;
|
|
public Animator Ani_1, Ani_2;
|
|
public string ParameterName;
|
|
public int ParameterValue;
|
|
float dTime;
|
|
void OnTriggerEnter()
|
|
{
|
|
if (Time.time - dTime > 2)
|
|
{
|
|
dTime = Time.time;
|
|
Aud_Btn.Play();
|
|
if (Ani_1 != null)
|
|
Ani_1.SetInteger(ParameterName, ParameterValue);
|
|
if (Ani_2 != null)
|
|
Ani_2.SetInteger(ParameterName, ParameterValue);
|
|
}
|
|
}
|
|
}
|