SW 중심대학 OSS GIT 서버
새로운 리포
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.Events;
public class ObjectActivator : MonoBehaviour{ public bool Toggle; public UnityEvent OnActivated; public UnityEvent OnDeactivated; public AudioClip audioClip; public AudioSource audioSource;
bool m_Activated = false; public void Activated() { if (Toggle) { if (m_Activated) OnDeactivated.Invoke(); else OnActivated.Invoke(); m_Activated = !m_Activated; audioSource.PlayOneShot(audioClip); } else { OnActivated.Invoke(); m_Activated = true; } }
public void Deactivated() { if (!Toggle) { OnDeactivated.Invoke(); m_Activated = false; } }}
|