您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
34 行
941 B
34 行
941 B
using System;
|
|
using UnityEngine;
|
|
|
|
namespace LobbyRelaySample.ngo
|
|
{
|
|
/// <summary>
|
|
/// Used by the host to deactivate symbol objects once they're off-screen.
|
|
/// </summary>
|
|
[RequireComponent(typeof(Collider))]
|
|
public class SymbolKillVolume : MonoBehaviour
|
|
{
|
|
private bool m_isInitialized = false;
|
|
private Action m_onSymbolCollided;
|
|
|
|
public void Initialize(Action onSymbolCollided)
|
|
{
|
|
m_onSymbolCollided = onSymbolCollided;
|
|
m_isInitialized = true;
|
|
}
|
|
|
|
public void OnTriggerEnter(Collider other)
|
|
{
|
|
if (!m_isInitialized)
|
|
return;
|
|
|
|
SymbolObject symbolObj = other.GetComponent<SymbolObject>();
|
|
if (symbolObj != null)
|
|
{
|
|
symbolObj.HideSymbol_ServerRpc();
|
|
m_onSymbolCollided?.Invoke();
|
|
}
|
|
}
|
|
}
|
|
}
|