Example #1
0
    public void SceneReferences()
    {
        BuilderInWorldController builderInWorldController = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];

        Assert.IsNotNull(builderInWorldController.avatarRenderer, "References on the builder-in-world prefab are null, check them all!");
        Assert.IsNotNull(builderInWorldController.cursorGO, "References on the builder-in-world prefab are null, check them all!");
        Assert.IsNotNull(builderInWorldController.inputController, "References on the builder-in-world prefab are null, check them all!");
        Assert.IsNotNull(builderInWorldController.cameraParentGO, "References on the builder-in-world prefab are null, check them all!");


        BuilderInWorldGodMode godMode = builderInWorldController.GetComponentInChildren <BuilderInWorldGodMode>();


        Assert.IsNotNull(godMode.mouseCatcher, "References on the builder-in-world god mode are null, check them all!");
        Assert.IsNotNull(godMode.cameraController, "References on the builder-in-world god mode are null, check them all!");
        Assert.IsNotNull(godMode.freeCameraController, "References on the builder-in-world god mode are null, check them all!");

        DCLBuilderRaycast dCLBuilderRaycast = godMode.GetComponentInChildren <DCLBuilderRaycast>();

        Assert.IsNotNull(dCLBuilderRaycast.builderCamera, "Camera reference on the builder-in-world god mode children are null, check them all!");

        VoxelController voxelController = godMode.GetComponent <VoxelController>();

        Assert.IsNotNull(voxelController.freeCameraMovement, "Camera reference on the builder-in-world voxel controller are null, check them all!");
    }
Example #2
0
    public void GroundRaycast()
    {
        RaycastHit hit;
        BuilderInWorldController builderInWorldController = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];
        BuilderInWorldGodMode    godMode = builderInWorldController.GetComponentInChildren <BuilderInWorldGodMode>(true);

        Vector3 fromPosition = new Vector3(0, 10, 0);
        Vector3 toPosition   = Vector3.zero;
        Vector3 direction    = toPosition - fromPosition;


        if (Physics.Raycast(fromPosition, direction, out hit, BuilderInWorldGodMode.RAYCAST_MAX_DISTANCE, godMode.groundLayer))
        {
            Assert.Pass();
            return;
        }

        UnityEngine.Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));

        if (Physics.Raycast(ray, out hit, BuilderInWorldGodMode.RAYCAST_MAX_DISTANCE, godMode.groundLayer))
        {
            Assert.Pass();
            return;
        }

        Assert.Fail("The ground layer is not set to Ground");
    }
Example #3
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        BuilderInWorldController controller = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];

        gizmosController = controller.biwModeController.editorMode.gizmoManager;
    }
Example #4
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        BuilderInWorldController controller = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];

        entityHandler = controller.builderInWorldEntityHandler;
        entityHandler.Init();

        TestHelpers.CreateSceneEntity(scene, ENTITY_ID);
        entityHandler.EnterEditMode(scene);
        entity = entityHandler.GetAllEntitiesFromCurrentScene().FirstOrDefault();
    }
Example #5
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        controller = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];

        controller.InitGameObjects();
        controller.FindSceneToEdit();
        controller.InitControllers();

        biwModeController = controller.biwModeController;
        biwModeController.EnterEditMode(scene);
    }
Example #6
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        controller = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];

        biwCreatorController = controller.biwCreatorController;
        biwCreatorController.Init();
        entityHandler = controller.builderInWorldEntityHandler;
        entityHandler.Init();

        entityHandler.EnterEditMode(scene);
        biwCreatorController.EnterEditMode(scene);
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        controller           = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];
        actionController     = controller.actionController;
        entityHandler        = controller.builderInWorldEntityHandler;
        biwFloorHandler      = controller.biwFloorHandler;
        biwCreatorController = controller.biwCreatorController;
        entityHandler.Init();

        TestHelpers.CreateSceneEntity(scene, ENTITY_ID);
        entityHandler.EnterEditMode(scene);
    }
Example #8
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        BuilderInWorldController controller = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];

        entityHandler = controller.builderInWorldEntityHandler;
        entityHandler.Init();
        entityHandler.EnterEditMode(scene);

        dummyGameObject = new GameObject();
        biwBridge       = Utils.GetOrCreateComponent <BuilderInWorldBridge>(dummyGameObject);

        WebInterface.OnMessageFromEngine += MessageReceived;
    }
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        BuilderInWorldController controller = Resources.FindObjectsOfTypeAll <BuilderInWorldController>()[0];

        outlinerController = controller.outlinerController;

        TestHelpers.CreateSceneEntity(scene, ENTITY_ID);

        TestHelpers.CreateAndSetShape(scene, ENTITY_ID, DCL.Models.CLASS_ID.GLTF_SHAPE, JsonConvert.SerializeObject(
                                          new
        {
            src = Utils.GetTestsAssetsPath() + "/GLB/Trunk/Trunk.glb"
        }));

        LoadWrapper gltfShape = GLTFShape.GetLoaderForEntity(scene.entities[ENTITY_ID]);

        yield return(new WaitUntil(() => gltfShape.alreadyLoaded));

        controller.builderInWorldEntityHandler.EnterEditMode(scene);
        entity = controller.builderInWorldEntityHandler.GetConvertedEntity(scene.entities[ENTITY_ID]);
    }
 public override void OnStepStart()
 {
     base.OnStepStart();
     builderInWorldController = FindObjectOfType <BuilderInWorldController>();
     builderInWorldController.OnSceneObjectPlaced += SceneObjectSelected;
 }