blob: 841ffc4b26adc78e08da8e23afaea98388f32a15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using Photon.Pun.Simple;
using UnityEngine;
public class TickMover : MonoBehaviour, IOnPostSimulate
{
private Vector3 rotationPerTick;
private TextMesh tickText;
private void Awake()
{
NetMasterCallbacks.RegisterCallbackInterfaces(this);
rotationPerTick = new Vector3(0f, 0f, 360f * (Time.fixedDeltaTime * (float)TickEngineSettings.sendEveryXTick));
tickText = GetComponentInChildren<TextMesh>();
if (!tickText)
{
tickText = GetComponentInParent<TextMesh>();
}
if ((bool)tickText)
{
tickText.text = "";
}
}
private void OnDestroy()
{
NetMasterCallbacks.RegisterCallbackInterfaces(this, register: false, delay: true);
}
public void OnPostSimulate(int frameId, int subFrameId, bool isNetTick)
{
if (isNetTick)
{
base.transform.eulerAngles -= rotationPerTick;
if ((bool)tickText)
{
tickText.text = frameId.ToString();
}
}
}
}
|