我们创建了 Fontainebleau 演示来说明摄影photogrammetry流程和 LayeredLit 着色器的使用。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

60 行
1.5 KiB

using UnityEngine;
using UnityEngine.Events;
namespace GameplayIngredients.Hooks
{
public class OnTriggerHook : HookBase
{
public int EnterMaxCount = 0;
public int ExitMaxCount = 0;
private int m_RemainingEnterCount;
private int m_RemainingExitCount;
public UnityEvent onTriggerEnter;
public UnityEvent onTriggerExit;
public bool OnlyInteractWithTag = true;
public string Tag = "Player";
void Start()
{
m_RemainingEnterCount = EnterMaxCount;
m_RemainingExitCount = ExitMaxCount;
}
private void OnTriggerEnter(Collider other)
{
if (EnterMaxCount > 0)
{
if (m_RemainingEnterCount == 0) return;
m_RemainingEnterCount--;
}
if (OnlyInteractWithTag && other.tag == Tag )
{
onTriggerEnter.Invoke();
}
if (!OnlyInteractWithTag)
{
onTriggerEnter.Invoke();
}
}
private void OnTriggerExit(Collider other)
{
if (ExitMaxCount > 0)
{
if (m_RemainingExitCount == 0) return;
m_RemainingExitCount--;
}
if (OnlyInteractWithTag && other.tag == Tag )
{
onTriggerExit.Invoke();
}
if (!OnlyInteractWithTag)
{
onTriggerExit.Invoke();
}
}
}
}