Esempio n. 1
0
    // public void addBackdrop()
    // {
    //     MeshInstance backdrop = new MeshInstance();
    //     backdrop.Mesh = new PlaneMesh{};

    //     var material = new SpatialMaterial{};
    //     // default color is black for plane
    //     Color color_black = new Color(0,0,0);

    //     material.AlbedoColor = color_black;
    //     backdrop.SetSurfaceMaterial(0, material);

    //     Vector3 scale = new Vector3(80, 0, 80);
    //     Vector3 position = new Vector3(-1f, 0, -1f);
    //     Vector3 rotation = new Vector3(30, 180-45, 30);

    //     backdrop.Scale = scale;
    //     backdrop.Translate(position);
    //     backdrop.RotationDegrees = rotation;

    //     AddChild(backdrop);
    //     return;
    // }

    public CanvasLayer addHUD()
    {
        new_hud = (PackedScene)ResourceLoader.Load("res://HUD.tscn");
        CanvasLayer hud = (CanvasLayer)new_hud.Instance();

        AddChild(hud);

        hud.Call("menuView");

        return(hud);
    }
Esempio n. 2
0
 public CommandBuilder AddCommand(string name, Godot.Object target, string targetMethodName)
 {
     Godot.Object consoleCommand = _console.Call("add_command", name, target, targetMethodName) as Godot.Object;
     return(new CommandBuilder(consoleCommand));
 }
Esempio n. 3
0
    // Called every frame. 'delta' is the elapsed time since the previous frame.
    public override void _Process(float delta)
    {
        int result = 0;

        result = (int)HUD.Call("buttonProcess", delta);

        if (result == 0)
        {
            return;
        }
        GD.Print(result);

        if ((result >= 2) && (result <= 7))
        {
            cube_size = result;
            moveCamera(cameraMain, cube_size);
            cube = addCube(cube_size);
            GD.Print(default_rot);
            GD.Print(camera_rot);

            //cube.Call("makeAxisLines", cube_size);
            return;
        }

        if (result == 10)
        {
            cube_size   = 0;
            edge_select = new Vector3(0, 0, 0);
            //cube.Call("removeAxisLines");

            // reset camera too
            cameraMain.Translation = zero_vec;
            cameraMain.GlobalTranslate(default_loc);
            camera_rot          = default_rot;
            cameraMain.Rotation = camera_rot;
            moveCamera(cameraMain, cube_size);

            RemoveChild(cube);
            return;
        }

        if ((result >= 0x100) && (result <= 0x104))
        {
            cube.Call("removeOutline");

            if (result == 0x100)
            {
                edge_select = new Vector3(1, 0, 0);
            }
            if (result == 0x101)
            {
                edge_select = new Vector3(0, 1, 0);
            }
            if (result == 0x102)
            {
                edge_select = new Vector3(0, 0, 1);
            }

            if ((result == 0x103) && (edge_select.Length() < cube_size))
            {
                edge_select = edge_select + edge_select.Normalized();
            }
            if ((result == 0x104) && (edge_select.Length() > 1))
            {
                edge_select = edge_select - edge_select.Normalized();
            }

            cube.Call("makeOutline", cube_size, edge_select);

            HUD.Call("cubeShow");

            return;
        }

        if (result == 0x105)
        {
            RemoveChild(cube);
            cube = addCube(cube_size);
        }

        if ((result >= 0x200) && (result <= 0x201))
        {
            if (result == 0x200)
            {
                twistCube(cube, cube_size, edge_select, -1, 1);
            }
            if (result == 0x201)
            {
                twistCube(cube, cube_size, edge_select, 1, 1);
            }
            HUD.Call("cubeShow");
        }

        //twistCube(cube, cube_size, edge_select, 1, 1);
        return;
    }