예제 #1
0
        public IEnumerator RefusesDifferent()
        {
            containingObject.AddComponent <Light>();
            SerializableTypeBehaviourObservableList behaviourTypes = containingObject.AddComponent <SerializableTypeBehaviourObservableList>();

            yield return(null);

            subject.BehaviourTypes = behaviourTypes;
            behaviourTypes.Add(typeof(TestScript));

            Assert.IsFalse(container.Accepts(containingObject));
        }
예제 #2
0
        public IEnumerator RefuseDisabledBehaviour()
        {
            TestScript testScript = containingObject.AddComponent <TestScript>();
            SerializableTypeBehaviourObservableList behaviourTypes = containingObject.AddComponent <SerializableTypeBehaviourObservableList>();

            yield return(null);

            subject.BehaviourTypes = behaviourTypes;
            behaviourTypes.Add(typeof(TestScript));
            testScript.enabled = false;

            Assert.IsFalse(container.Accepts(containingObject));
        }
예제 #3
0
        public IEnumerator RefusesInactiveGameObject()
        {
            TestScript testScript = containingObject.AddComponent <TestScript>();
            SerializableTypeBehaviourObservableList behaviourTypes = containingObject.AddComponent <SerializableTypeBehaviourObservableList>();

            yield return(null);

            subject.BehaviourTypes = behaviourTypes;
            behaviourTypes.Add(typeof(TestScript));
            testScript.enabled = true;
            subject.gameObject.SetActive(false);

            Assert.IsFalse(container.Accepts(containingObject));
        }
예제 #4
0
        public IEnumerator AcceptsInactiveComponent()
        {
            TestScript testScript = containingObject.AddComponent <TestScript>();
            SerializableTypeBehaviourObservableList behaviourTypes = containingObject.AddComponent <SerializableTypeBehaviourObservableList>();

            yield return(null);

            subject.BehaviourTypes = behaviourTypes;
            behaviourTypes.Add(typeof(TestScript));
            testScript.enabled = true;

            subject.AutoRejectStates = BaseRule.RejectRuleStates.RuleGameObjectIsNotActiveInHierarchy;
            subject.enabled          = false;

            Assert.IsTrue(container.Accepts(containingObject));

            subject.gameObject.SetActive(false);

            Assert.IsFalse(container.Accepts(containingObject));
        }