Untitled
unknown
csharp
4 years ago
2.3 kB
10
Indexable
public override void OnStartClient() { base.OnStartClient(); NetworkInitialize(base.IsOwner || base.IsServer, base.IsServer); } public override void OnStartServer() { base.OnStartServer(); NetworkInitialize(base.IsOwner || base.IsServer, true); startPrediction = true; } private void NetworkInitialize(bool authoritiveOrServer, bool isServer) { if (initializationDone) return; Debug.Log("auth:"+ authoritiveOrServer + " | server:"+isServer); initializationDone = true; if (authoritiveOrServer || isServer) { KinematicCharacterSystem.Settings.AutoSimulation = false; KinematicCharacterSystem.Settings.Interpolate = false; _controller = GetComponent<MovementHandler>(); _motor = GetComponent<KinematicCharacterMotor>(); motors = new List<KinematicCharacterMotor> {_motor}; clientPlayerInputs = new List<PlayerInputState>(); SimulationManager._instance.AddMotorAndController(_motor, this); if (IsServer) { if (IsOwner) { SimulationManager._instance.SetupLocalPlayer(_inputHandler,_cameraHandler); sendToServerPlayerInputs = new List<PlayerInputState>(); } else { _inputHandler.enabled = false; Debug.Log("called2"); _cameraHandler.enabled = false; } serverQueuePlayerInputs = new Queue<PlayerInputState>(); } else { SimulationManager._instance.SetupLocalPlayer(_inputHandler,_cameraHandler); sendToServerPlayerInputs = new List<PlayerInputState>(); } } else { _inputHandler.enabled = false; this.enabled = false; } }
Editor is loading...