private void GameEvents_onCharacterMoved(UserMovement data) { if (!_activePlayers.ContainsKey(data.UserId)) { return; } _activePlayers[data.UserId].Movement.MoveAndRotate(data); }
//on remote client public void MoveAndRotate(UserMovement newMovement) { //_animator.SetFloat("moveSpeed", (transform.position - newMovement.Position).magnitude); _lastRealPosition = _realPosition; _lastRealRotation = _realRotation; _realPosition = newMovement.Position; _realRotation = newMovement.Angle; _timeToLerp = newMovement.Time; if (_realPosition != transform.position) { _isLerpingPosition = true; } if (_realRotation.eulerAngles != transform.rotation.eulerAngles) { _isLerpingRotation = true; } _timeStartedLerping = Time.time; }
private void OnMoveCharacter(UserMovement direction) { _manager.Socket.Emit("move_character", direction); }
internal static void CharacterMoved(UserMovement direction) { onCharacterMoved?.Invoke(direction); }