public IEnumerator SwitchTo()
        {
            GameObject objectA = new GameObject();
            GameObject objectB = new GameObject();
            GameObject objectC = new GameObject();

            GameObjectObservableList targets = containingObject.AddComponent <GameObjectObservableList>();

            yield return(null);

            subject.Targets = targets;

            targets.Add(objectA);
            targets.Add(objectB);
            targets.Add(objectC);

            subject.TargetState          = true;
            subject.Targets.CurrentIndex = 0;

            subject.SwitchToCurrentIndex();

            Assert.IsTrue(objectA.activeInHierarchy);
            Assert.IsFalse(objectB.activeInHierarchy);
            Assert.IsFalse(objectC.activeInHierarchy);

            subject.SwitchTo(2);

            Assert.IsFalse(objectA.activeInHierarchy);
            Assert.IsFalse(objectB.activeInHierarchy);
            Assert.IsTrue(objectC.activeInHierarchy);

            subject.SwitchTo(0);

            Assert.IsTrue(objectA.activeInHierarchy);
            Assert.IsFalse(objectB.activeInHierarchy);
            Assert.IsFalse(objectC.activeInHierarchy);

            subject.SwitchTo(1);

            Assert.IsFalse(objectA.activeInHierarchy);
            Assert.IsTrue(objectB.activeInHierarchy);
            Assert.IsFalse(objectC.activeInHierarchy);

            subject.SwitchTo(5);

            Assert.IsFalse(objectA.activeInHierarchy);
            Assert.IsFalse(objectB.activeInHierarchy);
            Assert.IsTrue(objectC.activeInHierarchy);

            subject.SwitchTo(-2);

            Assert.IsTrue(objectA.activeInHierarchy);
            Assert.IsFalse(objectB.activeInHierarchy);
            Assert.IsFalse(objectC.activeInHierarchy);

            Object.DestroyImmediate(objectA);
            Object.DestroyImmediate(objectB);
            Object.DestroyImmediate(objectC);
        }
Exemplo n.º 2
0
 public void Test0()
 {
     XRSC.DisableXR();
     GOSS.SwitchTo(1);
 }