Пример #1
0
        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;
        }
Пример #2
0
        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;
        }
Пример #3
0
        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;
        }