浏览代码

Removed Counting in Trigger Event

/2018.3
Thomas ICHÉ 6 年前
当前提交
261855b8
共有 1 个文件被更改,包括 0 次插入23 次删除
  1. 23
      Runtime/LevelScripting/Events/OnTriggerEvent.cs

23
Runtime/LevelScripting/Events/OnTriggerEvent.cs


using NaughtyAttributes;
using UnityEngine;
public int EnterMaxCount = 0;
public int ExitMaxCount = 0;
private int m_RemainingEnterCount;
private int m_RemainingExitCount;
[ReorderableList]
public Callable[] onTriggerEnter;

public bool OnlyInteractWithTag = true;
public string Tag = "Player";
void Start()
{
m_RemainingEnterCount = EnterMaxCount;
m_RemainingExitCount = ExitMaxCount;
}
if (EnterMaxCount > 0)
{
if (m_RemainingEnterCount == 0) return;
m_RemainingEnterCount--;
}
if (OnlyInteractWithTag && other.tag == Tag )
{
Callable.Call(onTriggerEnter, other.gameObject);

private void OnTriggerExit(Collider other)
{
if (ExitMaxCount > 0)
{
if (m_RemainingExitCount == 0) return;
m_RemainingExitCount--;
}
if (OnlyInteractWithTag && other.tag == Tag )
{
Callable.Call(onTriggerExit, other.gameObject);

正在加载...
取消
保存