Beispiel #1
0
        public static IEnumerator TestShapeVisibility(BaseShape shapeComponent, BaseShape.Model shapeModel, DecentralandEntity entity)
        {
            // make sure the shape is visible first
            shapeModel.visible = true;
            yield return(SharedComponentUpdate(shapeComponent, shapeModel));

            // check every mesh is shown by default
            Renderer[] renderers = entity.meshesInfo.renderers;

            Assert.IsTrue(renderers.Length > 0);

            for (int i = 0; i < renderers.Length; i++)
            {
                Assert.IsTrue(renderers[i].enabled);
            }

            yield return(TestShapeOnPointerEventCollider(entity));

            // update visibility with 'false'
            shapeModel.visible = false;
            yield return(SharedComponentUpdate(shapeComponent, shapeModel));

            // check renderers correct behaviour
            for (int i = 0; i < renderers.Length; i++)
            {
                Assert.IsFalse(renderers[i].enabled);
            }

            yield return(TestShapeOnPointerEventCollider(entity));

            // update visibility with 'true'
            shapeModel.visible = true;
            yield return(SharedComponentUpdate(shapeComponent, shapeModel));

            // check renderers correct behaviour
            for (int i = 0; i < renderers.Length; i++)
            {
                Assert.IsTrue(renderers[i].enabled);
            }

            yield return(TestShapeOnPointerEventCollider(entity));
        }
Beispiel #2
0
        public static IEnumerator TestShapeCollision(BaseShape shapeComponent, BaseShape.Model shapeModel, DecentralandEntity entity)
        {
            var scene = shapeComponent.scene;

            // make sure the shape is collidable first
            shapeModel.withCollisions = true;
            SharedComponentUpdate(shapeComponent, shapeModel);
            yield return(shapeComponent.routine);

            // check every collider is enabled
            Assert.IsTrue(entity.meshesInfo.colliders.Count > 0);

            for (int i = 0; i < entity.meshesInfo.colliders.Count; i++)
            {
                Assert.IsTrue(entity.meshesInfo.colliders[i].enabled);
            }

            // update collision property with 'false'
            shapeModel.withCollisions = false;
            SharedComponentUpdate(shapeComponent, shapeModel);
            yield return(shapeComponent.routine);

            // check colliders correct behaviour
            for (int i = 0; i < entity.meshesInfo.colliders.Count; i++)
            {
                Assert.IsFalse(entity.meshesInfo.colliders[i].enabled);
            }

            // update collision property with 'true' again
            shapeModel.withCollisions = true;
            SharedComponentUpdate(shapeComponent, shapeModel);
            yield return(shapeComponent.routine);

            // check colliders correct behaviour
            for (int i = 0; i < entity.meshesInfo.colliders.Count; i++)
            {
                Assert.IsTrue(entity.meshesInfo.colliders[i].enabled);
            }
        }