void DefineComponents()
 {
     ComponentDefinition skeleton = new ComponentDefinition("skeleton");
     skeleton.AddAttribute<List<Vector>>("translations", new List<Vector>());
     skeleton.AddAttribute<List<Quat>>("rotations", new List<Quat>());
     ComponentRegistry.Instance.Register(skeleton);
 }
 void DefineComponents()
 {
     ComponentDefinition location = new ComponentDefinition("location");
     location.AddAttribute<Vector>("position", new Vector(0, 0, 0));
     location.AddAttribute<Quat>("orientation", new Quat(0, 0, 0, 1));
     ComponentRegistry.Instance.Register(location);
 }
 /// <summary>
 /// Register component that carries information about which model is used and what deviation
 /// map should be displayed in the synchronized views
 /// </summary>
 private void RegisterComponent()
 {
     ComponentDefinition deviationMapComponent = new ComponentDefinition("deviationmap");
     deviationMapComponent.AddAttribute<int>("selectedvector", 1);
     deviationMapComponent.AddAttribute<float>("threshold", 1.5f);
     ComponentRegistry.Instance.Register(deviationMapComponent);
 }
        void DefineComponents()
        {
            ComponentDefinition skeleton = new ComponentDefinition("skeleton");

            skeleton.AddAttribute <List <Vector> >("translations", new List <Vector>());
            skeleton.AddAttribute <List <Quat> >("rotations", new List <Quat>());
            ComponentRegistry.Instance.Register(skeleton);
        }
        internal void DefineComponents()
        {
            ComponentDefinition motion = new ComponentDefinition("motion");

            motion.AddAttribute <Vector>("velocity", new Vector(0, 0, 0));
            motion.AddAttribute <AxisAngle>("rotVelocity", new AxisAngle(0, 1, 0, 0));
            ComponentRegistry.Instance.Register(motion);
        }
Example #6
0
        /// <summary>
        /// Plugin and component dependencies are not resolved when using plugins in Unit tests.
        /// Therefore, we need to register the components of Location plugin manually
        /// </summary>
        private void RegisterLocationComponents()
        {
            ComponentDefinition locationComponent = new ComponentDefinition("location");

            locationComponent.AddAttribute <Vector>("position", new Vector(0, 0, 0));
            locationComponent.AddAttribute <Quat>("orientation", new Quat(0, 0, 0, 1));
            ComponentRegistry.Instance.Register(locationComponent);
        }
 private void registerLightComponent()
 {
     ComponentDefinition lightComponent = new ComponentDefinition("light");
     lightComponent.AddAttribute<LightType>("type");
     lightComponent.AddAttribute<Vector>("intensity");
     lightComponent.AddAttribute<Vector>("attenuation");
     ComponentRegistry.Instance.Register(lightComponent);
 }
 private void DefineComponents()
 {
     ComponentDefinition mesh = new ComponentDefinition("mesh");
     mesh.AddAttribute<string>("uri");
     mesh.AddAttribute<bool>("visible", true);
     mesh.AddAttribute<Vector>("scale", new Vector(1, 1, 1));
     ComponentRegistry.Instance.Register(mesh);
 }
        private void registerLightComponent()
        {
            ComponentDefinition lightComponent = new ComponentDefinition("light");

            lightComponent.AddAttribute <LightType>("type");
            lightComponent.AddAttribute <Vector>("intensity");
            lightComponent.AddAttribute <Vector>("attenuation");
            ComponentRegistry.Instance.Register(lightComponent);
        }
        private void DefineComponents()
        {
            ComponentDefinition mesh = new ComponentDefinition("mesh");

            mesh.AddAttribute <string>("uri");
            mesh.AddAttribute <bool>("visible", true);
            mesh.AddAttribute <Vector>("scale", new Vector(1, 1, 1));
            ComponentRegistry.Instance.Register(mesh);
        }
        /// <summary>
        /// Initializes the plugin. This method will be called by the plugin manager when all dependency plugins have
        /// been loaded.
        /// </summary>
        public void Initialize()
        {
            // Register 'scripting' component.
            ComponentDefinition scripting = new ComponentDefinition("scripting");
            scripting.AddAttribute<string>("ownerScript");
            scripting.AddAttribute<string>("serverScript");
            scripting.AddAttribute<string>("clientScript");
            ComponentRegistry.Instance.Register(scripting);

            Scripting.Instance = new Scripting();
        }
        /// <summary>
        /// Initializes the plugin. This method will be called by the plugin manager when all dependency plugins have
        /// been loaded.
        /// </summary>
        public void Initialize()
        {
            // Register 'scripting' component.
            ComponentDefinition scripting = new ComponentDefinition("scripting");

            scripting.AddAttribute <string>("ownerScript");
            scripting.AddAttribute <string>("serverScript");
            scripting.AddAttribute <string>("clientScript");
            ComponentRegistry.Instance.Register(scripting);

            Scripting.Instance = new Scripting();
        }
Example #13
0
        public void Init()
        {
            // Set up definition.
            definition = new ComponentDefinition("test-component");
            definition.AddAttribute<string>("a", "a_value");
            definition.AddAttribute<float>("b", 3.14f);

            // Set up containing entity.
            containingEntity = new Entity();

            // Create component.
            component = new Component(definition, containingEntity);
        }
        private void DefineComponents()
        {
            ComponentDefinition renderable = new ComponentDefinition("meshResource");

            renderable.AddAttribute <string>("uri");
            renderable.AddAttribute <bool>("visible", true);
            ComponentRegistry.Instance.Register(renderable);

            ComponentDefinition scale = new ComponentDefinition("scale");

            scale.AddAttribute <float>("x", 1f);
            scale.AddAttribute <float>("y", 1f);
            scale.AddAttribute <float>("z", 1f);
            ComponentRegistry.Instance.Register(scale);
        }
        public void Init()
        {
            // TODO: mock ComponentDefinition
            ComponentDefinition test = new ComponentDefinition("test");
            test.AddAttribute<int>("a", 42);
            test.AddAttribute<int?>("n", 5);

            mockComponentRegistry = new Mock<IComponentRegistry>();
            mockComponentRegistry.Setup(r => r.FindComponentDefinition("test")).Returns(test);

            entity = new Entity();
            entity.componentRegistry = mockComponentRegistry.Object;

            mockHandlers = new Mock<IMockHandlers>();
        }
        /// <summary>
        /// Component Dependencies are not resolved when faced in a test fixture, so we need to manually register the components the plugin needs
        /// to access.
        /// </summary>
        void MockComponentRegistry()
        {
            ComponentDefinition position = new ComponentDefinition("position");

            position.AddAttribute <float>("x");
            position.AddAttribute <float>("y");
            position.AddAttribute <float>("z");

            ComponentDefinition meshResource = new ComponentDefinition("meshResource");

            meshResource.AddAttribute <string>("uri");

            FIVES.ComponentRegistry.Instance.Register(position);
            FIVES.ComponentRegistry.Instance.Register(meshResource);
        }
        void RegisterComponent()
        {
            ComponentDefinition avatar = new ComponentDefinition("avatar");

            avatar.AddAttribute <string>("userLogin", null);
            ComponentRegistry.Instance.Register(avatar);
        }
Example #18
0
        /// <summary>
        /// Registers gravity component that carries the attribute for the groundlevel
        /// </summary>
        internal void RegisterComponents()
        {
            ComponentDefinition gravityDefinition = new ComponentDefinition("avatarCollision");

            gravityDefinition.AddAttribute <float>("groundLevel");
            ComponentRegistry.Instance.Register(gravityDefinition);
        }
Example #19
0
        public void Initialize()
        {
            ComponentDefinition avatar = new ComponentDefinition("avatar");

            avatar.AddAttribute <string>("userLogin", null);
            ComponentRegistry.Instance.Register(avatar);

            ClientManager.Instance.RegisterClientService("avatar", true, new Dictionary <string, Delegate> {
                { "getAvatarEntityGuid", (Func <Connection, string>)GetAvatarEntityGuid },
                { "changeAppearance", (Action <Connection, string, Vector>)ChangeAppearance },
                { "startAvatarMotionInDirection", (Action <Connection, Vector>)StartAvatarMotionInDirection },
                { "setAvatarForwardBackwardMotion", (Action <Connection, float>)SetForwardBackwardMotion },
                { "setAvatarLeftRightMotion", (Action <Connection, float>)SetLeftRightMotion },
                { "setAvatarSpinAroundAxis", (Action <Connection, Vector, float>)SetAvatarSpinAroundAxis }
            });

            ClientManager.Instance.NotifyWhenAnyClientAuthenticated(delegate(Connection connection) {
                Activate(connection);
                connection.Closed += (sender, e) => Deactivate(connection);
            });

            World.Instance.AddedEntity += HandleAddedEntity;

            foreach (var entity in World.Instance)
            {
                CheckAndRegisterAvatarEntity(entity);
            }
        }
Example #20
0
        internal void RegisterComponents()
        {
            ComponentDefinition animationComponent = new ComponentDefinition("animation");

            animationComponent.AddAttribute <string>("animationKeyframes");
            ComponentRegistry.Instance.Register(animationComponent);
        }
Example #21
0
        /// <summary>
        /// Plugin and component dependencies are not resolved when using plugins in Unit tests.
        /// Therefore, we need to register the components of Location plugin manually
        /// </summary>
        private void RegisterLocationComponents()
        {
            var positionComponent = new ComponentDefinition("position");

            positionComponent.AddAttribute <float>("x", 0f);
            positionComponent.AddAttribute <float>("y", 0f);
            positionComponent.AddAttribute <float>("z", 0f);
            ComponentRegistry.Instance.Register(positionComponent);

            var orientationComponent = new ComponentDefinition("orientation");

            orientationComponent.AddAttribute <float>("x", 0f);
            orientationComponent.AddAttribute <float>("y", 0f);
            orientationComponent.AddAttribute <float>("z", 0f);
            orientationComponent.AddAttribute <float>("w", 1f);
            ComponentRegistry.Instance.Register(orientationComponent);
        }
Example #22
0
        void DefineComponents()
        {
            // Velocity is represented as a vector (x,y,z) in world units per second.
            ComponentDefinition velocity = new ComponentDefinition("velocity");

            velocity.AddAttribute <float> ("x", 0f);
            velocity.AddAttribute <float> ("y", 0f);
            velocity.AddAttribute <float> ("z", 0f);
            ComponentRegistry.Instance.Register(velocity);

            // Rotation velocity is represented as an axis (x, y, z) and angular rotation r in radians per second.
            ComponentDefinition rotVelocity = new ComponentDefinition("rotVelocity");

            rotVelocity.AddAttribute <float>("x", 0f);
            rotVelocity.AddAttribute <float>("y", 1f);
            rotVelocity.AddAttribute <float>("z", 0f);
            rotVelocity.AddAttribute <float>("r", 0f);
            ComponentRegistry.Instance.Register(rotVelocity);
        }
 internal void RegisterPersistedComponents()
 {
     foreach (KeyValuePair<string, ReadOnlyComponentDefinition> definitionPair in this.OwnerRegisteredComponents)
     {
         ReadOnlyComponentDefinition roDefinition = definitionPair.Value;
         ComponentDefinition definition = new ComponentDefinition(roDefinition.Name);
         foreach (ReadOnlyAttributeDefinition attrDef in definition.AttributeDefinitions)
             definition.AddAttribute(attrDef.Name, attrDef.Type, attrDef.DefaultValue);
         Registry.Register (definition);
     }
 }
Example #24
0
        public void MockGlobalObjects()
        {
            handlers             = new Mock <IHandlers>();
            remoteConnectionMock = new Mock <Connection>();
            remoteConnectionMock.Setup(rc => rc.GenerateClientFunction("serverSync", "addEntity"))
            .Returns((ClientFunction)handlers.Object.AddEntity);
            remoteConnectionMock.Setup(rc => rc.GenerateClientFunction("serverSync", "removeEntity"))
            .Returns((ClientFunction)handlers.Object.RemoveEntity);
            remoteConnectionMock.Setup(rc => rc.GenerateClientFunction("serverSync", "changeAttributes"))
            .Returns((ClientFunction)handlers.Object.ChangeAttributes);

            doiMock = new Mock <IDomainOfInterest>();
            dorMock = new Mock <IDomainOfResponsibility>();
            doiMock.Setup(doi => doi.IsInterestedInEntity(It.IsAny <Entity>())).Returns(true);
            doiMock.Setup(doi => doi.IsInterestedInAttributeChange(It.IsAny <Entity>(), It.IsAny <string>(),
                                                                   It.IsAny <string>())).Returns(true);
            dorMock.Setup(dor => dor.IsResponsibleFor(It.IsAny <Entity>())).Returns(true);


            localServiceMock = new Mock <ServiceImplementation>();
            localServerMock  = new Mock <ILocalServer>();
            localServerMock.SetupGet(ls => ls.Service).Returns(localServiceMock.Object);
            localServerMock.SetupGet(ls => ls.DoI).Returns(doiMock.Object);
            localServerMock.SetupGet(ls => ls.DoR).Returns(dorMock.Object);

            remoteServer = new RemoteServerImpl(remoteConnectionMock.Object, doiMock.Object, dorMock.Object,
                                                Guid.NewGuid());

            serverSyncMock = new Mock <IServerSync>();
            serverSyncMock.Setup(ss => ss.RemoteServers).Returns(new List <IRemoteServer> {
                remoteServer
            });
            serverSyncMock.Setup(ss => ss.LocalServer).Returns(localServerMock.Object);

            var componentDefinition = new ComponentDefinition("test");

            componentDefinition.AddAttribute <int>("a", 42);

            componentRegistryMock = new Mock <IComponentRegistry>();
            componentRegistryMock.SetupGet(cr => cr.RegisteredComponents).Returns(
                new ReadOnlyCollection <ReadOnlyComponentDefinition>(new List <ReadOnlyComponentDefinition>()));
            componentRegistryMock.Setup(cr => cr.FindComponentDefinition("test"))
            .Returns(componentDefinition);

            serializationMock = new Mock <IStringSerialization>();

            ServerSync.Instance          = serverSyncMock.Object;
            ComponentRegistry.Instance   = componentRegistryMock.Object;
            StringSerialization.Instance = serializationMock.Object;
            World.Instance = new World();

            ServiceBus.Instance = new ServiceBusImplementation();
            ServiceBus.Instance.Initialize();
        }
        private ComponentDefinition RegisterExternalComponent(Connection conn, ExternalComponentDefinition definition)
        {
            ComponentDefinition c = new ComponentDefinition(definition.Name);

            foreach (ExternalAttributeDefinition attribute in definition.Attributes)
            {
                Type t = conn.SinTD.GetSinTDType(attribute.Type).InstanceType;
                c.AddAttribute(attribute.Name, t, attribute.DefaultValue);
            }
            ComponentRegistry.Instance.Register(c);
            return(c);
        }
        /// <summary>
        /// Component Dependencies are not resolved when faced in a test fixture, so we need to manually register the components the plugin needs
        /// to access.
        /// </summary>
        void MockComponentRegistry()
        {
            ComponentDefinition position = new ComponentDefinition("location");

            position.AddAttribute <Vector>("position", new Vector(0, 0, 0));

            ComponentDefinition mesh = new ComponentDefinition("mesh");

            mesh.AddAttribute <string>("uri");

            FIVES.ComponentRegistry.Instance.Register(position);
            FIVES.ComponentRegistry.Instance.Register(mesh);
        }
Example #27
0
 internal void RegisterPersistedComponents()
 {
     foreach (KeyValuePair <string, ReadOnlyComponentDefinition> definitionPair in this.OwnerRegisteredComponents)
     {
         ReadOnlyComponentDefinition roDefinition = definitionPair.Value;
         ComponentDefinition         definition   = new ComponentDefinition(roDefinition.Name);
         foreach (ReadOnlyAttributeDefinition attrDef in definition.AttributeDefinitions)
         {
             definition.AddAttribute(attrDef.Name, attrDef.Type, attrDef.DefaultValue);
         }
         Registry.Register(definition);
     }
 }
Example #28
0
        void DefineComponents()
        {
            // Position is represented as a vector (x,y,z) from the default position, which is at (0,0,0).
            ComponentDefinition position = new ComponentDefinition("position");

            position.AddAttribute <float> ("x", 0f);
            position.AddAttribute <float> ("y", 0f);
            position.AddAttribute <float> ("z", 0f);
            ComponentRegistry.Instance.Register(position);

            // Orientation is represented as a quaternion, where (x,y,z) is a vector part, and w is a scalar part. The
            // orientation of the object is relative to the default orientation. In the default position and
            // orientation, the viewer is on the Z-axis looking down the -Z-axis toward the origin with +X to the right
            // and +Y straight up.
            ComponentDefinition orientation = new ComponentDefinition("orientation");

            orientation.AddAttribute <float>("x", 0f);
            orientation.AddAttribute <float>("y", 0f);
            orientation.AddAttribute <float>("z", 0f);
            orientation.AddAttribute <float>("w", 1f);
            ComponentRegistry.Instance.Register(orientation);
        }
        public void ShouldConvertCompatibleDefaultValues()
        {
            ComponentDefinition def = new ComponentDefinition("defTypeTest");

            def.AddAttribute<double>("c", 42.0);
            def.AddAttribute<int?>("e", null);
            def.AddAttribute<int?>("f", 34);

            Assert.Catch<AttributeDefinitionException>(delegate {
                def.AddAttribute<double>("d", 42);
            });

            Assert.Catch<AttributeDefinitionException>(delegate {
                def.AddAttribute<double>("a", 42);
            });

            Assert.Catch<AttributeDefinitionException>(delegate {
                def.AddAttribute<double>("b", 42f);
            });

            Assert.Catch<AttributeDefinitionException>(delegate {
                def.AddAttribute<int>("g", 3.14);
            });
        }
 internal void RegisterComponents()
 {
     ComponentDefinition animationComponent = new ComponentDefinition("animation");
     animationComponent.AddAttribute<string>("animationKeyframes");
     ComponentRegistry.Instance.Register(animationComponent);
 }
 /// <summary>
 /// Registers gravity component that carries the attribute for the groundlevel
 /// </summary>
 internal void RegisterComponents()
 {
     ComponentDefinition gravityDefinition = new ComponentDefinition("avatarCollision");
     gravityDefinition.AddAttribute<float>("groundLevel");
     ComponentRegistry.Instance.Register(gravityDefinition);
 }
        public void MockGlobalObjects()
        {
            handlers = new Mock<IHandlers>();
            remoteConnectionMock = new Mock<Connection>();
            remoteConnectionMock.Setup(rc => rc.GenerateClientFunction("serverSync", "addEntity"))
                .Returns((ClientFunction)handlers.Object.AddEntity);
            remoteConnectionMock.Setup(rc => rc.GenerateClientFunction("serverSync", "removeEntity"))
                .Returns((ClientFunction)handlers.Object.RemoveEntity);
            remoteConnectionMock.Setup(rc => rc.GenerateClientFunction("serverSync", "changeAttributes"))
                .Returns((ClientFunction)handlers.Object.ChangeAttributes);

            doiMock = new Mock<IDomainOfInterest>();
            dorMock = new Mock<IDomainOfResponsibility>();
            doiMock.Setup(doi => doi.IsInterestedInEntity(It.IsAny<Entity>())).Returns(true);
            doiMock.Setup(doi => doi.IsInterestedInAttributeChange(It.IsAny<Entity>(), It.IsAny<string>(),
                It.IsAny<string>())).Returns(true);
            dorMock.Setup(dor => dor.IsResponsibleFor(It.IsAny<Entity>())).Returns(true);

            localServiceMock = new Mock<ServiceImplementation>();
            localServerMock = new Mock<ILocalServer>();
            localServerMock.SetupGet(ls => ls.Service).Returns(localServiceMock.Object);
            localServerMock.SetupGet(ls => ls.DoI).Returns(doiMock.Object);
            localServerMock.SetupGet(ls => ls.DoR).Returns(dorMock.Object);

            remoteServer = new RemoteServerImpl(remoteConnectionMock.Object, doiMock.Object, dorMock.Object,
                Guid.NewGuid());

            serverSyncMock = new Mock<IServerSync>();
            serverSyncMock.Setup(ss => ss.RemoteServers).Returns(new List<IRemoteServer> { remoteServer });
            serverSyncMock.Setup(ss => ss.LocalServer).Returns(localServerMock.Object);

            var componentDefinition = new ComponentDefinition("test");
            componentDefinition.AddAttribute<int>("a", 42);

            componentRegistryMock = new Mock<IComponentRegistry>();
            componentRegistryMock.SetupGet(cr => cr.RegisteredComponents).Returns(
                new ReadOnlyCollection<ReadOnlyComponentDefinition>(new List<ReadOnlyComponentDefinition>()));
            componentRegistryMock.Setup(cr => cr.FindComponentDefinition("test"))
                .Returns(componentDefinition);

            serializationMock = new Mock<IStringSerialization>();

            ServerSync.Instance = serverSyncMock.Object;
            ComponentRegistry.Instance = componentRegistryMock.Object;
            StringSerialization.Instance = serializationMock.Object;
            World.Instance = new World();

            ServiceBus.Instance = new ServiceBusImplementation();
            ServiceBus.Instance.Initialize();
        }
Example #33
0
        internal void DefineComponents()
        {
            posture.AddAttribute <double>("x", 0.0);
            posture.AddAttribute <double>("y", 0.0);
            posture.AddAttribute <double>("z", 0.0);
            posture.AddAttribute <double>("wx", 0.0);
            posture.AddAttribute <double>("wy", 0.0);
            posture.AddAttribute <double>("wz", 0.0);

            posture.AddAttribute <double>("HeadYaw", 0.0);
            posture.AddAttribute <double>("HeadPitch", 0.0);
            posture.AddAttribute <double>("RShoulderPitch", 0.0);
            posture.AddAttribute <double>("RShoulderRoll", -0.5);
            posture.AddAttribute <double>("RElbowRoll", 0.5);
            posture.AddAttribute <double>("RElbowYaw", 0.0);
            posture.AddAttribute <double>("RWristYaw", 0.0);
            posture.AddAttribute <double>("RHand", 0.0);

            posture.AddAttribute <double>("LShoulderPitch", 0.0);
            posture.AddAttribute <double>("LShoulderRoll", -0.5);
            posture.AddAttribute <double>("LElbowRoll", 0.5);
            posture.AddAttribute <double>("LElbowYaw", 0.0);
            posture.AddAttribute <double>("LWristYaw", 0.0);
            posture.AddAttribute <double>("LHand", 0.0);

            posture.AddAttribute <double>("RHipYawPitch", 0.0);
            posture.AddAttribute <double>("RHipPitch", 0.0);
            posture.AddAttribute <double>("RHipRoll", 0.0);
            posture.AddAttribute <double>("RKneePitch", 0.0);
            posture.AddAttribute <double>("RAnklePitch", 0.0);
            posture.AddAttribute <double>("RAnkleRoll", 0.0);

            posture.AddAttribute <double>("LHipYawPitch", 0.0);
            posture.AddAttribute <double>("LHipPitch", 0.0);
            posture.AddAttribute <double>("LHipRoll", 0.0);
            posture.AddAttribute <double>("LKneePitch", 0.0);
            posture.AddAttribute <double>("LAnklePitch", 0.0);
            posture.AddAttribute <double>("LAnkleRoll", 0.0);

            ComponentRegistry.Instance.Register(posture);
        }
 public void Init()
 {
     registry = new ComponentRegistry();
     definition = new ComponentDefinition("test2");
     definition.AddAttribute<int>("a", 42);
 }
 internal void DefineComponents()
 {
     ComponentDefinition motion = new ComponentDefinition("motion");
     motion.AddAttribute<Vector>("velocity", new Vector(0, 0, 0));
     motion.AddAttribute<AxisAngle>("rotVelocity", new AxisAngle(0, 1, 0, 0));
     ComponentRegistry.Instance.Register(motion);
 }
        public void MockGlobalObjects()
        {
            handlers = new Mock<IHandlers>();
            remoteConnectionMock = new Mock<Connection>();
            remoteConnectionMock.Setup(rc => rc.GenerateClientFunction("serverSync", "registerComponentDefinition"))
                .Returns((ClientFunction)handlers.Object.RegisterComponentDefinition);

            var remoteServerMock = new Mock<IRemoteServer>();
            remoteServerMock.Setup(rs => rs.Connection).Returns(remoteConnectionMock.Object);

            localServiceMock = new Mock<ServiceImplementation>();
            var localServerMock = new Mock<ILocalServer>();
            localServerMock.SetupGet(ls => ls.Service).Returns(localServiceMock.Object);

            var serverSyncMock = new Mock<IServerSync>();
            serverSyncMock.Setup(ss => ss.RemoteServers).Returns(new List<IRemoteServer> { remoteServerMock.Object });
            serverSyncMock.Setup(ss => ss.LocalServer).Returns(localServerMock.Object);

            componentRegistryMock = new Mock<IComponentRegistry>();
            componentRegistryMock.SetupGet(cr => cr.RegisteredComponents).Returns(
                new ReadOnlyCollection<ReadOnlyComponentDefinition>(new List<ReadOnlyComponentDefinition>()));

            ServerSync.Instance = serverSyncMock.Object;
            ComponentRegistry.Instance = componentRegistryMock.Object;

            testComponentDefinition = new ComponentDefinition("test");
            testComponentDefinition.AddAttribute<float>("f", 3.14f);
            testComponentDefinition.AddAttribute<int>("i", 42);
        }
 void DefineComponents()
 {
     ComponentDefinition BVHAnimation = new ComponentDefinition("BVHAnimation");
     BVHAnimation.AddAttribute<string>("bvhheader");
     BVHAnimation.AddAttribute<string>("bvhframe");
     BVHAnimation.AddAttribute<string>("bvhmarker");
     BVHAnimation.AddAttribute<string>("bvhaction");
     ComponentRegistry.Instance.Register(BVHAnimation);
 }
        /// <summary>
        /// Component Dependencies are not resolved when faced in a test fixture, so we need to manually register the components the plugin needs
        /// to access.
        /// </summary>
        void MockComponentRegistry()
        {
            ComponentDefinition position = new ComponentDefinition("location");
            position.AddAttribute<Vector>("position", new Vector(0, 0, 0));

            ComponentDefinition mesh = new ComponentDefinition("mesh");
            mesh.AddAttribute<string>("uri");

            FIVES.ComponentRegistry.Instance.Register(position);
            FIVES.ComponentRegistry.Instance.Register(mesh);
        }
Example #39
0
 void RegisterComponent()
 {
     ComponentDefinition avatar = new ComponentDefinition("avatar");
     avatar.AddAttribute<string>("userLogin", null);
     ComponentRegistry.Instance.Register(avatar);
 }