Fixed rope startup errors
This commit is contained in:
parent
9017315bfe
commit
007e762a47
|
@ -108,12 +108,16 @@ public class RopeSimulator : NetworkBehaviour
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
GameManager.OnPlayersReady += PlayersReady;
|
GameManager.OnPlayersReady += PlayersReady;
|
||||||
|
|
||||||
|
if (NetworkManager.Singleton != null)
|
||||||
NetworkManager.Singleton.NetworkTickSystem.Tick += NetworkTick;
|
NetworkManager.Singleton.NetworkTickSystem.Tick += NetworkTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
GameManager.OnPlayersReady -= PlayersReady;
|
GameManager.OnPlayersReady -= PlayersReady;
|
||||||
|
|
||||||
|
if (NetworkManager.Singleton != null)
|
||||||
NetworkManager.Singleton.NetworkTickSystem.Tick -= NetworkTick;
|
NetworkManager.Singleton.NetworkTickSystem.Tick -= NetworkTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +388,8 @@ public class RopeSimulator : NetworkBehaviour
|
||||||
|
|
||||||
private GameState ProcessGame()
|
private GameState ProcessGame()
|
||||||
{
|
{
|
||||||
GameState localState = new() {
|
GameState localState = new()
|
||||||
|
{
|
||||||
tick = currentTick,
|
tick = currentTick,
|
||||||
nrope = Rope.ToNetworkRope(this.rope),
|
nrope = Rope.ToNetworkRope(this.rope),
|
||||||
enemyPositions = GameObject.FindObjectsByType<EnemyPathFinding>(FindObjectsSortMode.None).Select(e => new Vector3(e.transform.position.x, e.transform.position.y, e.GetComponent<NetworkObject>().NetworkObjectId)).ToArray(),
|
enemyPositions = GameObject.FindObjectsByType<EnemyPathFinding>(FindObjectsSortMode.None).Select(e => new Vector3(e.transform.position.x, e.transform.position.y, e.GetComponent<NetworkObject>().NetworkObjectId)).ToArray(),
|
||||||
|
|
Loading…
Reference in New Issue