You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
//Shady
|
|
using Fusion;
|
|
using UnityEngine;
|
|
|
|
public class TriggerTest : MonoBehaviour
|
|
{
|
|
[SerializeField] bool _goOffline = true;
|
|
[SerializeField] bool _isTriggered = false;
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if(_goOffline)
|
|
{
|
|
if(other.gameObject.layer == 6)
|
|
{
|
|
NetworkObject player = other.GetComponentInParent<NetworkObject>();
|
|
if(player.HasInputAuthority && _isTriggered is false)
|
|
{
|
|
_isTriggered = true;
|
|
Debug.Log($"{player.name}");
|
|
GameManager.Instance.GoOffline();
|
|
}//if end
|
|
}//if end
|
|
}//if end
|
|
else
|
|
{
|
|
if(other.gameObject.layer == 6)
|
|
{
|
|
TopDownPlayerOffline offlinePlayer = other.GetComponentInParent<TopDownPlayerOffline>();
|
|
if(offlinePlayer != null)
|
|
{
|
|
_isTriggered = true;
|
|
Debug.Log($"{offlinePlayer.name}");
|
|
GameManager.Instance.GoOnline();
|
|
}//if end
|
|
}//if end
|
|
}//else end
|
|
}//OnTriggerEnter() end
|
|
|
|
}//class end |