Super Knight : Enter the Dungeon
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;
|
|
|
|
|
using UnityEngine.Serialization;
|
|
|
|
|
|
|
|
|
|
public class TriggerEvent : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Collider col;
|
|
|
|
|
//private void OnEnable()
|
|
|
|
|
//{
|
|
|
|
|
// if (ONCE && col.enabled)
|
|
|
|
|
// col.enabled = true;
|
|
|
|
|
// else if(!ONCE)
|
|
|
|
|
// col.enabled = true;
|
|
|
|
|
//}
|
|
|
|
|
private void OnDisable()
|
|
|
|
|
{
|
|
|
|
|
ON = false;
|
|
|
|
|
}
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public class OnTriggerEvent : UnityEvent { }
|
|
|
|
|
[FormerlySerializedAs("onTrigger")]
|
|
|
|
|
[Space(10)]
|
|
|
|
|
[SerializeField]
|
|
|
|
|
public OnTriggerEvent OnTrigger = new OnTriggerEvent();
|
|
|
|
|
|
|
|
|
|
public bool ONCE = false;
|
|
|
|
|
[OnlyRead]
|
|
|
|
|
public bool ON = false;
|
|
|
|
|
private void OnCollisionEnter(Collision collision)
|
|
|
|
|
{
|
|
|
|
|
if (ON)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (collision.gameObject.CompareTag("Our"))
|
|
|
|
|
{
|
|
|
|
|
if (ONCE)
|
|
|
|
|
ON = true;
|
|
|
|
|
|
|
|
|
|
OnTrigger.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//void OnTriggerEnter(Collider other)
|
|
|
|
|
//{
|
|
|
|
|
// Debug.LogWarning($"{other.name}");
|
|
|
|
|
// if (other.CompareTag("Our"))
|
|
|
|
|
// {
|
|
|
|
|
// if (ONCE)
|
|
|
|
|
// col.enabled = false;
|
|
|
|
|
|
|
|
|
|
// OnTrigger.Invoke();
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|