示例#1
0
 internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider)
 {
     if (collider.Shape is ConcavePolygonShape concavePolygonShape)
     {
         Patch(app, concavePolygonShape);
     }
 }
示例#2
0
 internal override void Patch(MixedRealityExtensionApp app, UnityCollider collider)
 {
     if (collider is SphereCollider sphereCollider)
     {
         Patch(sphereCollider);
     }
 }
示例#3
0
 internal override void Patch(MixedRealityExtensionApp app, UnityCollider collider)
 {
     if (collider is BoxCollider boxCollider)
     {
         Patch(boxCollider);
     }
 }
示例#4
0
 internal AssetLoader(MonoBehaviour owner, MixedRealityExtensionApp app)
 {
     _owner       = owner ?? throw new ArgumentException("Asset loader requires an owner MonoBehaviour script to be assigned to it.");
     _app         = app ?? throw new ArgumentException("Asset loader requires a MixedRealityExtensionApp to be associated with.");
     _asyncHelper = _owner.gameObject.GetComponent <AsyncCoroutineHelper>() ??
                    _owner.gameObject.AddComponent <AsyncCoroutineHelper>();
 }
示例#5
0
 internal override void Patch(MixedRealityExtensionApp app, UnityCollider collider)
 {
     if (collider is MeshCollider meshCollider)
     {
         Patch(app, meshCollider);
     }
 }
 internal override void SendEvent(MixedRealityExtensionApp app)
 {
     app.Protocol.Send(new ActorUpdate()
     {
         Actor = _actor
     });
 }
 internal override void SendEvent(MixedRealityExtensionApp app)
 {
     app.Protocol.Send(new CollisionEventRaised()
     {
         ActorId       = ActorId,
         EventType     = _eventType,
         CollisionData = _collisionData
     });
 }
 internal override void SendEvent(MixedRealityExtensionApp app)
 {
     app.Protocol.Send(new TriggerEventRaised()
     {
         ActorId      = ActorId,
         EventType    = _eventType,
         OtherActorId = _otherActor
     });
 }
示例#9
0
 public ConsoleLogger(MixedRealityExtensionApp app)
 {
     _app   = app;
     traces = new Traces();
     traces.AddTrace(new Trace()
     {
         Severity = TraceSeverity.Info, Message = null
     });
 }
        /// <summary>
        /// Creates a new mixed reality extension app and adds it to the MRE runtime.
        /// </summary>
        /// <param name="globalAppId">The global app id for the app being instanced.</param>
        /// <param name="ownerScript">The owner unity script for the app.</param>
        /// <returns>Returns the newly created mixed reality extension app.</returns>
        public IMixedRealityExtensionApp CreateMixedRealityExtensionApp(string globalAppId, MonoBehaviour ownerScript)
        {
            var mreApp = new MixedRealityExtensionApp(globalAppId, ownerScript)
            {
                InstanceId = Guid.NewGuid()
            };

            _apps.Add(mreApp.InstanceId, mreApp);
            return(mreApp);
        }
示例#11
0
 private static void ProcessQueue(Queue <IMWEvent> eventQueue, MixedRealityExtensionApp app)
 {
     if (eventQueue.Count > 0)
     {
         var payloads = new List <Payload>();
         while (eventQueue.Count != 0)
         {
             eventQueue.Dequeue().SendEvent(app);
         }
     }
 }
        internal override void SendEvent(MixedRealityExtensionApp app)
        {
            if (app.Protocol == null)
            {
                return;
            }

            app.Protocol.Send(new PhysicsTranformServerUpload()
            {
                PhysicsTranformServer = _physicsTransformUploadPatch
            });
        }
        internal override void SendEvent(MixedRealityExtensionApp app)
        {
            if (app.Protocol == null)
            {
                return;
            }

            app.Protocol.Send(new PhysicsBridgeUpdate()
            {
                PhysicsBridgePatch = _physicsBridgePatch
            });
        }
示例#14
0
        private void Patch(MixedRealityExtensionApp app, ConcavePolygonShape concavePolygonShape)
        {
            var tempId = MeshId;

            app.AssetManager.OnSet(MeshId, asset =>
            {
                if (MeshId != tempId)
                {
                    return;
                }
                concavePolygonShape.Data = (Vector3[])(asset.Asset as Mesh).SurfaceGetArrays(0)[0];
            });
        }
        /// <summary>
        /// Creates a new mixed reality extension app and adds it to the MRE runtime.
        /// </summary>
        /// <param name="ownerScript">The owner unity script for the app.</param>
        /// <param name="ephemeralAppId">A unique identifier for the MRE behind this instance's URL, in the absence
        /// of a global app ID. Used for generating user IDs that are consistent within this session across clients,
        /// but not reliable across time. Must be synchronized across all clients in this session, and must be
        /// periodically rotated.</param>
        /// <param name="globalAppId">A unique identifier for the MRE behind this instance's URL. Used for generating
        /// consistent user IDs for this MRE. Would typically come from an app registry or similar. If supplied, must
        /// be synchronized across all clients in this session.
        /// </param>
        /// <returns>Returns the newly created mixed reality extension app.</returns>
        public IMixedRealityExtensionApp CreateMixedRealityExtensionApp(
            Node ownerScript,
            string ephemeralAppId,
            string globalAppId)
        {
            var mreApp = new MixedRealityExtensionApp(globalAppId ?? string.Empty, ephemeralAppId, ownerScript)
            {
                InstanceId = Guid.NewGuid()
            };

            _apps.Add(mreApp.InstanceId, mreApp);
            return(mreApp);
        }
 internal override void SendEvent(MixedRealityExtensionApp app)
 {
     app.Protocol.Send(new SetAnimationState
     {
         ActorId       = this.ActorId,
         AnimationName = this.animationName,
         State         = new MWSetAnimationStateOptions
         {
             Time    = this.animationTime,
             Speed   = this.animationSpeed,
             Enabled = this.animationEnabled
         }
     });
 }
示例#17
0
        private void Patch(MixedRealityExtensionApp app, MeshCollider collider)
        {
            var tempId = MeshId;

            app.AssetCache.OnCached(MeshId, asset =>
            {
                if (MeshId != tempId)
                {
                    return;
                }
                collider.sharedMesh = asset as Mesh;
                collider.convex     = true;
            });
        }
示例#18
0
        internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider)
        {
            if (collider.Shape is CylinderShape cylinderShape)
            {
                Vector3 newCenter = Vector3.Zero;
                Basis   basis     = Basis.Identity;
                if (Center != null)
                {
                    newCenter.x = Center.X;
                    newCenter.y = Center.Y;
                    newCenter.z = Center.Z;
                }

                if (Dimensions != null)
                {
                    float radius;
                    float height;
                    if (Mathf.IsEqualApprox(Dimensions.X, Dimensions.Y))
                    {
                        height = Dimensions.Z;
                        radius = Dimensions.X / 2;
                    }
                    else if (Mathf.IsEqualApprox(Dimensions.X, Dimensions.Z))
                    {
                        height = Dimensions.Y;
                        radius = Dimensions.X / 2;
                    }
                    else
                    {
                        height = Dimensions.X;
                        radius = Dimensions.Y / 2;
                    }
                    cylinderShape.Radius = radius;
                    cylinderShape.Height = height;

                    if (Dimensions.X == height)
                    {
                        basis = basis.Rotated(Vector3.Forward, Mathf.Pi / 2);
                    }
                    else if (Dimensions.Z == height)
                    {
                        basis = basis.Rotated(Vector3.Right, Mathf.Pi / 2);
                    }
                }
                collider.Transform = new Transform(basis, newCenter);
            }
        }
示例#19
0
        internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider)
        {
            if (collider.Shape is SphereShape sphereCollider)
            {
                if (Center != null)
                {
                    Vector3 newCenter;
                    newCenter.x        = Center.X;
                    newCenter.y        = Center.Y;
                    newCenter.z        = Center.Z;
                    collider.Transform = new Transform(Basis.Identity, newCenter);
                }

                if (Radius != null)
                {
                    sphereCollider.Radius = Radius.Value;
                }
            }
        }
示例#20
0
        internal override void Patch(MixedRealityExtensionApp app, GodotCollisionShape collider)
        {
            if (collider.Shape is BoxShape boxShape)
            {
                if (Center != null)
                {
                    Vector3 newCenter;
                    newCenter.x        = Center.X;
                    newCenter.y        = Center.Y;
                    newCenter.z        = Center.Z;
                    collider.Transform = new Transform(Basis.Identity, newCenter);
                }

                if (Size != null)
                {
                    Vector3 newSize;
                    newSize.x        = Size.X;
                    newSize.y        = Size.Y;
                    newSize.z        = Size.Z;
                    boxShape.Extents = newSize;
                }
            }
        }
 public UnityLogger(MixedRealityExtensionApp app) : base(app)
 {
 }
示例#22
0
 internal Protocol(MixedRealityExtensionApp app)
 {
     App = app;
 }
示例#23
0
 internal Idle(MixedRealityExtensionApp app)
     : base(app)
 {
 }
 internal UserManager(MixedRealityExtensionApp app)
 {
     _app = app;
 }
 internal Execution(MixedRealityExtensionApp app)
     : base(app)
 {
 }
示例#26
0
 internal MWEventManager(MixedRealityExtensionApp app)
 {
     _app             = app;
     _eventsQueue     = new Queue <IMWEvent>();
     _lateEventsQueue = new Queue <IMWEvent>();
 }
 internal abstract void SendEvent(MixedRealityExtensionApp app);
 void IMWEvent.SendEvent(MixedRealityExtensionApp app)
 {
     this.SendEvent(app);
 }
示例#29
0
 internal abstract void Patch(MixedRealityExtensionApp app, UnityCollider collider);
示例#30
0
 internal override void Patch(MixedRealityExtensionApp app, UnityCollider collider)
 {
     // We do not accept patching for auto colliders from the app.
 }