// Use this for initialization private void Start() { _lastUpdatedState = new PlayerPosition(Time.time, transform.position, -1, GetComponent <Health>().GetCurrentHealth()); _positionChannel = new PlayerPositionStateChannel(this, new TrivialStrategy(), 0.1f); _inputChannel = new InputSequenceEventChannel((a) => { }, new TrivialStrategy()); ClientConnectionManager.Instance.ChannelManager.RegisterChannel((int)RegisteredChannels.PlayerPositionChannel, _positionChannel); ClientConnectionManager.Instance.ChannelManager.RegisterChannel((int)RegisteredChannels.PlayerInputChannel, _inputChannel); GetComponent <Rigidbody> ().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; health = GetComponent <Health>(); }
public void SetupChannels(ChannelManager cm) { _positionChannel = new PlayerPositionStateChannel(this, new TrivialStrategy(), 0.1f); cm.RegisterChannel((int)RegisteredChannels.PlayerPositionChannel, _positionChannel); _positionChannel.StartSending(); _inputChannel = new InputSequenceEventChannel((a) => { foreach (var playerAction in a) { _inputManager.ReceivePlayerAction(playerAction); } }, new TrivialStrategy()); cm.RegisterChannel((int)RegisteredChannels.PlayerInputChannel, _inputChannel); }