示例#1
0
 public static CylinderShape CreateEntityWithCylinderShape(ParcelScene scene, Vector3 position,
                                                           CylinderShape.Model model = null)
 {
     return(CreateEntityWithPrimitive <CylinderShape, CylinderShape.Model>(scene, position,
                                                                           CLASS_ID.CYLINDER_SHAPE, model));
 }
    public IEnumerator VisibleProperty()
    {
        string entityId = "entityId";

        TestHelpers.CreateSceneEntity(scene, entityId);
        var entity = scene.entities[entityId];

        TestHelpers.SetEntityTransform(scene, entity, new DCLTransform.Model {
            position = new Vector3(8, 1, 8)
        });

        yield return(null);

        // BoxShape
        BaseShape.Model shapeModel     = new BoxShape.Model();
        BaseShape       shapeComponent = TestHelpers.SharedComponentCreate <BoxShape, BaseShape.Model>(scene, CLASS_ID.BOX_SHAPE, shapeModel);

        yield return(shapeComponent.routine);

        TestHelpers.SharedComponentAttach(shapeComponent, entity);

        yield return(TestHelpers.TestShapeVisibility(shapeComponent, shapeModel, entity));

        TestHelpers.DetachSharedComponent(scene, entityId, shapeComponent.id);
        shapeComponent.Dispose();
        yield return(null);

        // SphereShape
        shapeModel     = new SphereShape.Model();
        shapeComponent = TestHelpers.SharedComponentCreate <SphereShape, BaseShape.Model>(scene, CLASS_ID.SPHERE_SHAPE, shapeModel);
        yield return(shapeComponent.routine);

        TestHelpers.SharedComponentAttach(shapeComponent, entity);

        yield return(TestHelpers.TestShapeVisibility(shapeComponent, shapeModel, entity));

        TestHelpers.DetachSharedComponent(scene, entityId, shapeComponent.id);
        shapeComponent.Dispose();
        yield return(null);

        // ConeShape
        shapeModel     = new ConeShape.Model();
        shapeComponent = TestHelpers.SharedComponentCreate <ConeShape, BaseShape.Model>(scene, CLASS_ID.CONE_SHAPE, shapeModel);
        yield return(shapeComponent.routine);

        TestHelpers.SharedComponentAttach(shapeComponent, entity);

        yield return(TestHelpers.TestShapeVisibility(shapeComponent, shapeModel, entity));

        TestHelpers.DetachSharedComponent(scene, entityId, shapeComponent.id);
        shapeComponent.Dispose();
        yield return(null);

        // CylinderShape
        shapeModel     = new CylinderShape.Model();
        shapeComponent = TestHelpers.SharedComponentCreate <CylinderShape, BaseShape.Model>(scene, CLASS_ID.CYLINDER_SHAPE, shapeModel);
        yield return(shapeComponent.routine);

        TestHelpers.SharedComponentAttach(shapeComponent, entity);

        yield return(TestHelpers.TestShapeVisibility(shapeComponent, shapeModel, entity));

        TestHelpers.DetachSharedComponent(scene, entityId, shapeComponent.id);
        shapeComponent.Dispose();
        yield return(null);

        // PlaneShape
        shapeModel     = new PlaneShape.Model();
        shapeComponent = TestHelpers.SharedComponentCreate <PlaneShape, BaseShape.Model>(scene, CLASS_ID.PLANE_SHAPE, shapeModel);
        yield return(shapeComponent.routine);

        TestHelpers.SharedComponentAttach(shapeComponent, entity);

        yield return(TestHelpers.TestShapeVisibility(shapeComponent, shapeModel, entity));

        TestHelpers.DetachSharedComponent(scene, entityId, shapeComponent.id);
        shapeComponent.Dispose();
        yield return(null);
    }