浏览代码

remove collider stay and trigger stay

/main
Laurent 5 年前
当前提交
feb47b78
共有 2 个文件被更改,包括 8 次插入38 次删除
  1. 31
      Runtime/LevelScripting/Events/OnColliderEvent.cs
  2. 15
      Runtime/LevelScripting/Events/OnTriggerEvent.cs

31
Runtime/LevelScripting/Events/OnColliderEvent.cs


[ReorderableList]
public Callable[] onCollisionExit;
[ReorderableList]
public Callable[] onCollisionStay;
private void OnCollisionEnter(Collider other)
private void OnCollisionEnter(Collision other)
if (OnlyInteractWithTag && other.tag == Tag)
if (OnlyInteractWithTag && other.collider.tag == Tag)
Callable.Call(onCollisionEnter, other.gameObject);
Callable.Call(onCollisionEnter, other.collider.gameObject);
Callable.Call(onCollisionEnter, other.gameObject);
Callable.Call(onCollisionEnter, other.collider.gameObject);
private void OnCollisionExit(Collider other)
private void OnCollisionExit(Collision other)
if (OnlyInteractWithTag && other.tag == Tag)
if (OnlyInteractWithTag && other.collider.tag == Tag)
Callable.Call(onCollisionExit, other.gameObject);
Callable.Call(onCollisionExit, other.collider.gameObject);
Callable.Call(onCollisionExit, other.gameObject);
}
}
private void OnCollisionStay(Collider other)
{
if (OnlyInteractWithTag && other.tag == Tag)
{
Callable.Call(onCollisionStay, other.gameObject);
}
if (!OnlyInteractWithTag)
{
Callable.Call(onCollisionStay, other.gameObject);
Callable.Call(onCollisionExit, other.collider.gameObject);
}
}
}

15
Runtime/LevelScripting/Events/OnTriggerEvent.cs


[ReorderableList]
public Callable[] onTriggerExit;
[ReorderableList]
public Callable[] onTriggerStay;
public bool OnlyInteractWithTag = true;
[EnableIf("OnlyInteractWithTag")]
public string Tag = "Player";

if (!OnlyInteractWithTag)
{
Callable.Call(onTriggerExit, other.gameObject);
}
}
private void OnTriggerSta(Collider other)
{
if (OnlyInteractWithTag && other.tag == Tag)
{
Callable.Call(onTriggerStay, other.gameObject);
}
if (!OnlyInteractWithTag)
{
Callable.Call(onTriggerStay, other.gameObject);
}
}
}
正在加载...
取消
保存