public PlayerNetworkTrackerChangeUpdateRequest(NetworkMovementTrackerTypeFlags updateFields, [NotNull] Vector3[] trackerPositionUpdates, [NotNull] Quaternion[] trackerRotationUpdates) { if (trackerPositionUpdates == null) { throw new ArgumentNullException(nameof(trackerPositionUpdates)); } if (trackerRotationUpdates == null) { throw new ArgumentNullException(nameof(trackerRotationUpdates)); } if (updateFields == NetworkMovementTrackerTypeFlags.None) { throw new ArgumentException($"Cannot send {NetworkMovementTrackerTypeFlags.None} as no updates exist."); } UpdateFields = updateFields; if (trackerPositionUpdates.Length != trackerRotationUpdates.Length) { throw new ArgumentException($"Must send the same length of {nameof(trackerPositionUpdates)} and {nameof(trackerRotationUpdates)}"); } TrackerPositionUpdates = trackerPositionUpdates; TrackerRotationUpdates = trackerRotationUpdates; }
private static int InitializeRotationIndex(NetworkMovementTrackerTypeFlags context, NetworkMovementTrackerTypeFlags flagToCheck, EntityGameObjectDirectory.Type gameObjectType, Quaternion[] rotations, int index, EntityGameObjectDirectory directory) { if((context & flagToCheck) != 0) directory.GetGameObject(gameObjectType).transform.localRotation = rotations[index++]; return index; }
private static int InitializePositionIndex(NetworkMovementTrackerTypeFlags context, NetworkMovementTrackerTypeFlags flagToCheck, EntityGameObjectDirectory.Type gameObjectType, Vector3[] positions, int index, EntityGameObjectDirectory directory) { //cameraTransform.position = (rootTransform.position + args.ChangeInformation.Data.TrackerPositionUpdates[0]); if((context & flagToCheck) != 0) directory.GetGameObject(gameObjectType).transform.localPosition = positions[index++]; return index; }