예제 #1
0
    public override void _Ready()
    {
        _scoreLabel      = GetNode <Label>("Score");
        _scoreLabel.Text = "";
        _timeLabel       = GetNode <Label>("TimeRemaining");
        _timeLabel.Text  = "";
        _clockSound      = GetNode <AudioStreamPlayer>("Clock");
        _buzzerSound     = GetNode <AudioStreamPlayer>("Buzzer");
        VBoxContainer gameManager = GetNode <VBoxContainer>("../../GamePage");

        gameManager.Connect("ScoreUpdated", this, nameof(OnScoreUpdated));
        gameManager.Connect("TimeRemainingUpdated", this, nameof(OnTimeRemainingUpdated));
        gameManager.Connect("StartGame", this, nameof(OnStartGame));
        gameManager.Connect("GameOver", this, nameof(OnGameOver));
    }
예제 #2
0
    public override void _Ready()
    {
        //Set up Buttons to be initially disabled
        _redButton    = GetNode <Button>("ColorButtons/RedButton");
        _blueButton   = GetNode <Button>("ColorButtons/BlueButton");
        _yellowButton = GetNode <Button>("ColorButtons/YellowButton");
        _redButton.Connect("pressed", this, nameof(OnRedButtonPressed));
        _blueButton.Connect("pressed", this, nameof(OnBlueButtonPressed));
        _yellowButton.Connect("pressed", this, nameof(OnYellowButtonPressed));
        _redButton.Disabled    = true;
        _blueButton.Disabled   = true;
        _yellowButton.Disabled = true;

        Button quitButton = GetNode <Button>("QuitToMainMenu");

        quitButton.Connect("pressed", this, nameof(OnQuitToMainMenuPressed));

        VBoxContainer gameManager = GetNode <VBoxContainer>("../../GamePage");

        gameManager.Connect("StartGame", this, nameof(OnStartGame));
        gameManager.Connect("GameOver", this, nameof(OnGameOver));
    }
예제 #3
0
    public override void _Ready()
    {
        CenterContainer word = GetNode <CenterContainer>("WordContainer");

        word.Connect("ColorValidationComplete", this, nameof(_OnColorValidationComplete));

        //Connect Color and Quit Buttons
        VBoxContainer gameButtons = GetNode <VBoxContainer>("GameButtons");

        gameButtons.Connect("ColorButtonPressed", this, nameof(CheckCorrectButtonPressed));
        gameButtons.Connect("QuitButtonPressed", this, nameof(OnQuitToMainMenuPressed));

        _startTimer = GetNode <Timer>("StartTimer");
        _startTimer.Connect("timeout", this, nameof(OnStartTimerTimeout));
        _timeBeforeStart = 3;
        _gameStarted     = false;

        _timeRemaining = GetNode <Timer>("TimeRemaining");
        _timeRemaining.Connect("timeout", this, nameof(OnTimeRemainingTimeout));

        _secondsRemaining = 60;
    }
예제 #4
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        Colors = new Dictionary <string, Color>();
        Color red    = new Color(.722f, .116f, .116f);
        Color blue   = new Color(.212f, .212f, .833f);
        Color yellow = new Color(.884f, .884f, .27f);
        Color white  = new Color(1f, 1f, 1f);

        Colors.Add("red", red);
        Colors.Add("blue", blue);
        Colors.Add("yellow", yellow);
        Colors.Add("white", white);

        _wordLabel = GetNode <Label>("Word");
        _wordLabel.Set("custom_colors/font_color", Colors["red"]);
        VBoxContainer gameManager = GetNode <VBoxContainer>("../../GamePage");

        gameManager.Connect("ColorChosen", this, nameof(OnColorChosen));
        gameManager.Connect("StartTimerUpdated", this, nameof(OnStartTimerUpdated));
        gameManager.Connect("StartGame", this, nameof(OnStartGame));
        gameManager.Connect("GameOver", this, nameof(OnGameOver));
    }
예제 #5
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        this.Connect(
            "UpdateVelocities",
            GetNode("/root/main/UI/AppWindow/LeftMenu/ObjectInspector/ObjectInspector/VBoxContainer/VelocityMenu"),
            "UpdateAllVels"
            );
        this.Connect(
            "UpdateTransform",
            GetNode("/root/main/UI/AppWindow/LeftMenu/ObjectInspector/ObjectInspector/VBoxContainer/TransformMenu"),
            "UpdateAllTrans"
            );
        this.Connect(
            "UpdateJointInfo",
            GetNode("/root/main/UI/AppWindow/LeftMenu/ObjectInspector/JointController"),
            "AddJointDetail"
            );

        GetNode("/root/main/UI/AppWindow/LeftMenu/TreeContainer/Environment").Connect("ObjectSelected", this, "TreeItemSelected");

        // Connect translation signals
        VBoxContainer TransformInspector = (VBoxContainer)GetNode("/root/main/UI/AppWindow/LeftMenu/ObjectInspector/ObjectInspector/VBoxContainer/TransformMenu");

        TransformInspector.Connect("XTrans", this, "TranslateX");
        TransformInspector.Connect("YTrans", this, "TranslateY");
        TransformInspector.Connect("ZTrans", this, "TranslateZ");
        TransformInspector.Connect("XRot", this, "RotX");
        TransformInspector.Connect("YRot", this, "RotY");
        TransformInspector.Connect("ZRot", this, "RotZ");

        Node temp = GetNode("SelectedObject");

        GD.Print(temp.GetType());
        marker = (Godot.Spatial)temp;

        // Connect tree update signal
        Connect(nameof(envUpdated), GetNode("/root/main/UI/AppWindow/LeftMenu/TreeContainer/Environment/"), "UpdateTree");

        gizmo = GetNode <Spatial>("/root/main/UI/AppWindow/EnvironmentContainer/4WayViewport/VerticalSplit/HSplit1/Viewport1/Viewport/gizmos");

        for (var i = 0; i < gizmo.GetChildCount(); ++i)
        {
            gizmo.GetChild(i).Connect("HandlePressed", this, "GizmoClicked");
            gizmo.GetChild(i).Connect("HandleUnpressed", this, "GizmoUnclicked");
        }

        simState         = false;
        GetTree().Paused = simState;

        // gizmo.Visible = false;
        GD.Print("ENV.CS: READY");
    }