24 lines
514 B
C#
24 lines
514 B
C#
using Photon.Pun;
|
|
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
public sealed class GetPlayerCountBehavior : GuardedValueNodeBehavior
|
|
{
|
|
protected override void Start()
|
|
{
|
|
RecomputeCore();
|
|
}
|
|
|
|
public override void OnGraphUpdate()
|
|
{
|
|
RecomputeCore();
|
|
}
|
|
|
|
protected override void RecomputeCore()
|
|
{
|
|
int num = 0;
|
|
num = ((!PhotonNetwork.InRoom) ? 1 : ((PhotonNetwork.CurrentRoom != null) ? PhotonNetwork.CurrentRoom.PlayerCount : 0));
|
|
SetLocalOutputValueIfChanged("Count", BSValue.FromNumber(num));
|
|
}
|
|
}
|