Exemple #1
0
    public void InitMapForPreview()
    {
        GetDraggableMapObjects();
        TurnOnMapObjectColliders();

        TurnOffDraggingMapObjects();

        var playerObj = GameObject.FindWithTag("Player");

        playerObj.transform.parent = null;

        playerObj.GetComponent <PlayerCharacter>().playerMovement.canMove = true;
        playerObj.rigidbody.useGravity = true;
        playerObj.collider.enabled     = true;
        mainCam.AddComponent <CameraFollow>();
        levelCreator.CheckEdgeCubeNeighbours();

        var nullCubes = GameObject.FindGameObjectsWithTag("NullCube");
        var wallCubes = GameObject.FindGameObjectsWithTag("WallCube");

        foreach (var nullCube in nullCubes)
        {
            nullCube.renderer.enabled = false;
            nullCube.collider.enabled = true;
            nullCube.GetComponent <BoxCollider>().size = new Vector3(1, 10, 1);
        }
        foreach (var wallCube in wallCubes)
        {
            wallCube.renderer.enabled = false;
            wallCube.collider.enabled = true;
            wallCube.GetComponent <BoxCollider>().size = new Vector3(1, 10, 1);
        }

        LevelController.Instance.InitLevel(false);
    }