예제 #1
0
        public void Writer_is_injected_when_entity_component_is_checked_out_and_authoritative()
        {
            ConnectionHandler.ChangeAuthority(EntityId, Position.ComponentId, Authority.Authoritative);
            ReceiveSystem.Update();

            createdGameObject = CreateAndLinkGameObjectWithComponent <PositionWriterBehaviour>(EntityId);
            var writerBehaviour = createdGameObject.GetComponent <PositionWriterBehaviour>();

            Assert.IsTrue(writerBehaviour.enabled);
            Assert.IsNotNull(writerBehaviour.Writer);
        }
        public void Monobehaviour_is_disabled_with_non_matching_WorkerType_and_satisfied_requireable()
        {
            ConnectionHandler.ChangeAuthority(EntityId, Position.ComponentId, Authority.Authoritative);
            ReceiveSystem.Update();

            createdGameObject = CreateAndLinkGameObjectWithComponent <NonMatchingWorkerTypeWithRequireable>(EntityId);
            var behaviour = createdGameObject.GetComponent <NonMatchingWorkerTypeWithRequireable>();

            Assert.IsFalse(behaviour.enabled);
            Assert.IsNull(behaviour.Writer);
        }
예제 #3
0
        public void Injection_happens_if_all_constraints_are_satisfied()
        {
            ConnectionHandler.ChangeAuthority(EntityId, Position.ComponentId, Authority.Authoritative);
            ReceiveSystem.Update();

            createdGameObject = CreateAndLinkGameObjectWithComponent <CompositeBehaviour>(EntityId);
            var compositeBehaviour = createdGameObject.GetComponent <CompositeBehaviour>();

            Assert.IsTrue(compositeBehaviour.enabled);
            Assert.IsNotNull(compositeBehaviour.Reader);
            Assert.IsNotNull(compositeBehaviour.Writer);
        }