示例#1
0
 /// <summary>
 ///   Smoothly interpolates the value of a TextureProgress bar.
 /// </summary>
 public void TweenBarValue(TextureProgress bar, float targetValue, float maxValue, float speed)
 {
     bar.MaxValue = maxValue;
     Tween.InterpolateProperty(bar, "value", bar.Value, targetValue, speed,
                               Tween.TransitionType.Cubic, Tween.EaseType.Out);
     Tween.Start();
 }
示例#2
0
    protected Enums.Genes specialGene; // ice, fire, etc

    async public override void _Ready()
    {
        bar               = (TextureProgress)FindNode("HealthBar");
        pathTween         = (Tween)FindNode("PathFollowTween");
        animPlayer        = (AnimationPlayer)FindNode("AnimationPlayer");
        animSprite        = (AnimatedSprite)FindNode("AnimatedSprite");
        transparencyTween = (Tween)FindNode("TransparencyTween");
        attackTimer       = (Timer)FindNode("AttackingTimer");
        var thumpSound = (AudioStreamPlayer)FindNode("ThumpSound");

        thumpSound.Play();

        await SpawnDelay();

        bar.MaxValue = dinoHealth;
        bar.Value    = dinoHealth;
        bar.Show();

        animPlayer.Play(dinoVariation.ToString() + "walk");

        pathTween.InterpolateProperty(
            GetParent(), "unit_offset", 0, 1, pathFollowTime, Tween.TransitionType.Linear, Tween.EaseType.InOut
            );
        pathTween.Start();

        Events.dinoHit += UpdateHealth;
    }
示例#3
0
    public override void _Ready()
    {
        ManaProgress          = GetNodeOrNull <TextureProgress>("/root/Core/Game/UI/VBoxContainer/ManapointBar");
        ManaLabel             = ManaProgress.GetNodeOrNull <Label>("ManaLabel");
        MaxMana               = 5;
        Mana                  = MaxMana;
        ManaProgress.MaxValue = MaxMana;
        ManaProgress.MinValue = 0;
        ManaProgress.Step     = 0.1f;
        ManaLabel.Text        = $"{Mana}/{MaxMana}";

        HealthLabel             = GetNodeOrNull <Label>("/root/Core/Game/UI/VBoxContainer/HealthBar/LifeLabel");
        HealthProgress          = GetNodeOrNull <TextureProgress>("/root/Core/Game/UI/VBoxContainer/HealthBar");
        MaxHealth               = 5;
        Health                  = MaxHealth;
        HealthProgress.MinValue = 0;
        HealthProgress.MaxValue = MaxHealth;
        HealthLabel.Text        = $"{Health}/{MaxHealth}";

        MaxMoney       = 10000;
        Money          = 0;
        CoinLabel      = GetNodeOrNull <Label>("/root/Core/Game/UI/CoinsContainer/Coins");
        CoinLabel.Text = $"{Money}";

        Scores           = 0;
        ScoresLabel      = GetNodeOrNull <Label>("/root/Core/Game/UI/ScoresContainer/Scores");
        ScoresLabel.Text = $"Scores: {Scores}";
    }
示例#4
0
    public override void _Ready()
    {
        compoundBars = GetTree().GetNodesInGroup("CompoundBar");

        mouseHoverPanel              = GetNode <PanelContainer>(MouseHoverPanelPath);
        pauseButton                  = GetNode <TextureButton>(PauseButtonPath);
        resumeButton                 = GetNode <TextureButton>(ResumeButtonPath);
        leftPanels                   = GetNode <VBoxContainer>(LeftPanelsPath);
        agentsPanel                  = GetNode <Control>(AgentsPanelPath);
        environmentPanel             = GetNode <NinePatchRect>(EnvironmentPanelPath);
        environmentPanelBarContainer = GetNode <GridContainer>(EnvironmentPanelBarContainerPath);
        glucoseBar                   = GetNode <ProgressBar>(GlucoseBarPath);
        ammoniaBar                   = GetNode <ProgressBar>(AmmoniaBarPath);
        phosphateBar                 = GetNode <ProgressBar>(PhosphateBarPath);
        hydrogenSulfideBar           = GetNode <ProgressBar>(HydrogenSulfideBarPath);
        ironBar                    = GetNode <ProgressBar>(IronBarPath);
        compoundsPanel             = GetNode <NinePatchRect>(CompoundsPanelPath);
        CompoundsPanelBarContainer = GetNode <GridContainer>(CompoundsPanelBarContainerPath);
        oxytoxyBar                 = GetNode <ProgressBar>(OxytoxyBarPath);
        atpBar    = GetNode <TextureProgress>(AtpBarPath);
        healthBar = GetNode <TextureProgress>(HealthBarPath);
        ammoniaReproductionBar   = GetNode <TextureProgress>(AmmoniaReproductionBarPath);
        phosphateReproductionBar = GetNode <TextureProgress>(PhosphateReproductionBarPath);
        atpLabel        = GetNode <Label>(AtpLabelPath);
        hpLabel         = GetNode <Label>(HpLabelPath);
        menu            = GetNode <Control>(MenuPath);
        animationPlayer = GetNode <AnimationPlayer>(AnimationPlayerPath);
        hoveredItems    = GetNode <VBoxContainer>(HoveredItemsContainerPath);
        populationLabel = GetNode <Label>(PopulationLabelPath);
        patchLabel      = GetNode <Label>(PatchLabelPath);
        editorButton    = GetNode <TextureButton>(EditorButtonPath);
        helpScreen      = GetNode <Control>(HelpScreenPath);

        OnEnterStageTransition();
    }
示例#5
0
    public override void _Ready()
    {
        GD.Print("[Editor] EditorHandler Initialized.");

        // Fait les references aux autres nodes.
        GameHandler  = GetNode("../GameHandler") as Node2D;
        NodeHandler  = GetNode("NodeHandler") as Node2D;
        LevelHandler = GetNode("LevelHandler") as Node2D;

        EditorMenu  = GetNode("EditorMenu") as PopupMenu;
        EntExplorer = GetNode("EntExplorer") as Popup;

        ScaleBar    = GetNode("ScaleBar") as Popup;
        ScaleBarBar = ScaleBar.GetNode("Bar") as TextureProgress;

        MakeMenu();
        GD.Print("[Editor] MainMenu Initialized.");

        FireArea = ResourceLoader.Load("res://Content/Scenes/Entities/Spells/FireAOE/FireArea.tscn") as PackedScene;
        Chest    = ResourceLoader.Load("res://Content/Scenes/Entities/Chest.tscn") as PackedScene;
        OilArea  = ResourceLoader.Load("res://Content/Scenes/Entities/Oil/OilArea.tscn") as PackedScene;
        Tree     = ResourceLoader.Load("res://Content/Scenes/Entities/Trees/Tree.tscn") as PackedScene;
        Rock     = ResourceLoader.Load("res://Content/Scenes/Entities/Rocks/Rock.tscn") as PackedScene;
        Bush1    = ResourceLoader.Load("res://Content/Scenes/Entities/Bush/Bush1.tscn") as PackedScene;
        Bush2    = ResourceLoader.Load("res://Content/Scenes/Entities/Bush/Bush2.tscn") as PackedScene;

        GD.Print("[Editor] EditorHandler references loaded.");
    }
示例#6
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        automaticControllerCheckBox = FindNode("AutomaticControllerCheckBox") as CheckBox;
        automaticControllerCheckBox.Connect("toggled", this, nameof(HandleAutomaticControllerCheckBoxChanged));
        ufoDriveCheckBox = FindNode("UFODriveCheckBox") as CheckBox;
        ufoDriveCheckBox.Connect("toggled", this, nameof(HandleUFODriveCheckBoxChanged));



        driveSelectOptionButton = FindNode("DriveSelectOptionButton") as OptionButton;
        //driveSelectOptionButton.Connect("item_selected", this, nameof(HandleDriveItemSelected));

        mainThrusterLabel           = FindNode("Main Thruster") as Label;
        portForeThrusterLabel       = FindNode("Port Fore Thruster") as Label;
        portAftThrusterLabel        = FindNode("Port Aft Thruster") as Label;
        starboardForeThrusterLabel  = FindNode("Starboard Fore Thruster") as Label;
        starboardAftThrusterLabel   = FindNode("Starboard Aft Thruster") as Label;
        portRetroThrusterLabel      = FindNode("Port Retro Thruster") as Label;
        starboardRetroThrusterLabel = FindNode("Starboard Retro Thruster") as Label;

        mainThrusterProgressBar           = FindNode("MainThrusterProgressBar") as TextureProgress;
        portForeThrusterProgressBar       = FindNode("PortForeThrusterProgressBar") as TextureProgress;
        portAftThrusterProgressBar        = FindNode("PortAftThrusterProgressBar") as TextureProgress;
        starboardForeThrusterProgressBar  = FindNode("StarboardForeThrusterProgressBar") as TextureProgress;
        starboardAftThrusterProgressBar   = FindNode("StarboardAftThrusterProgressBar") as TextureProgress;
        portRetroThrusterProgressBar      = FindNode("PortRetroThrusterProgressBar") as TextureProgress;
        starboardRetroThrusterProgressBar = FindNode("StarboardRetroThrusterProgressBar") as TextureProgress;
    }
示例#7
0
    public override void _Ready()
    {
        _fillSprite = GetNode <Sprite>("PotionFill");
        _potionBar  = GetParent().GetNode <TextureProgress>("PotionProgress");

        FillState = FillStates.Empty;
    }
 public void Load()
 {
     barRed    = (Texture)GD.Load("res://Assets/UI/barHorizontal_red_mid 200.png");
     barYellow = (Texture)GD.Load("res://Assets/UI/barHorizontal_yellow_mid 200.png");
     barGreen  = (Texture)GD.Load("res://Assets/UI/barHorizontal_green_mid 200.png");
     healthBar = (TextureProgress)GetNode("HealthBar");
 }
示例#9
0
文件: UI.cs 项目: IndieRonin/Guardian
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     HealthEvent.RegisterListener(UpdateHealthbar);
     UIEvent.RegisterListener(UpdateUI);
     healthbar     = GetNode <TextureProgress>("Healthbar");
     waveCountDown = GetNode <Label>("CountDown");
 }
示例#10
0
    public void ModelSync(int?viewTime = null)
    {
        targetPosition = new Vector2((int)role.position.x, (int)role.position.y);
        // Position = new Vector2(
        //     targetPosition.x * View.TILESIZE.x,
        //     targetPosition.y * View.TILESIZE.y
        // );
        Position = targetPosition * View.TILESIZE; // elementwise
        // positionLerp = 0;

        health = role.health;
        status?.Call("set_health", role.health, role.species.maxHealth);

        TextureProgress healthbar = GetNode <TextureProgress>("HealthBar");

        healthbar.Value = role.health;

        // idk, its kind of ugly
        if (viewTime is int viewTimeeeee)
        {
            TextureProgress combobar = GetNode <TextureProgress>("ComboBar");
            combobar.Value = role.nextMove - viewTimeeeee;
        }

        // sprite stuff
        if (health <= 0)
        {
            this.Visible = false;
        }
        else
        {
            // AnimationPlayer aniPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
            // aniPlayer.Queue("Reset");
        }

        status?.Call("set_energy", role.energy, 10);

        stunned = role.stunned;
        AnimatedSprite aniSprite = GetNode <AnimatedSprite>("AnimatedSprite");

        // aniSprite.Frames = GD.Load<SpriteFrames>($"res://Crawler/View/ActorData/{role.species.ResourceName}.tres");
        if (role.stunned)
        {
            aniSprite.Frame = 1;
        }
        else if (role.queuedAction is ReachAttackAction.ReachAttackActive)
        {
            aniSprite.Frame = 2;
        }
        else
        {
            aniSprite.Frame = 0;
        }

        // TODO: Temporary
        displayName = role.species.displayName;

        seen = role.visibleToPlayer;
    }
示例#11
0
 public override void _Ready()
 {
     _healthBar      = GetParent().GetNode <TextureProgress>("HUD/MainContainer/HealthContainer/HealthBar");
     _fleetHealthBar = GetParent().GetNode <TextureProgress>("HUD/MainContainer/FleetHealthContainer/FleetHealthBar");
     _gunDamage      = GetParent().GetNode <Label>("HUD/MainContainer/GunDamageContainer/GunDamage");
     _missileDamage  = GetParent().GetNode <Label>("HUD/MainContainer/MissileDamageContainer/MissileDamage");
     _metalScrap     = GetParent().GetNode <Label>("HUD/MainContainer/MetalScrapContainer/MetalScrap");
 }
示例#12
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        healthbar = GetNode <TextureProgress>("Health");
        ammobar   = GetNode <TextureProgress>("Ammo");

        SendHealthEvent.RegisterListener(UpdateHealth);
        SendAmmoEvent.RegisterListener(UpdateAmmo);
    }
示例#13
0
    /// <summary>
    ///   Smoothly interpolates the value of a TextureProgress bar.
    /// </summary>
    public void TweenBarValue(TextureProgress bar, float targetValue, float maxValue)
    {
        var percentage = (targetValue / maxValue) * 100;

        tween.InterpolateProperty(bar, "value", bar.Value, percentage, 0.3f,
                                  Tween.TransitionType.Linear, Tween.EaseType.Out);
        tween.Start();
    }
示例#14
0
        public override void _Ready()
        {
            _healthProgress = GetNode <TextureProgress>(healthProgressNodePath);
            _healthSetter   = GetNode <HealthSetter>(healthSetterNodePath);

            _healthSetter.healthChanged += HandleHealthChanged;
            HandleHealthChanged(_healthSetter.GetCurrentHealth(), _healthSetter.GetMaxHealth());
        }
示例#15
0
 public override void _Ready()
 {
     _healthLabel     = GetNode <Label>("HPPanel/HBoxContainer/HPLabel");
     _healthBar       = GetNode <TextureProgress>("HPPanel/HBoxContainer/HealthBar");
     _xpBar           = GetNode <ProgressBar>("XPBar");
     _experienceLabel = _xpBar.GetNode <Label>("ExperienceLabel");
     _levelUpLabel    = GetNode <LevelUpLabel>("LevelUpLabel");
 }
示例#16
0
    public void ActAs(Entity role)
    {
        this.role = role;
        TextureProgress healthbar = GetNode <TextureProgress>("HealthBar");

        healthbar.MaxValue = role.species.maxHealth;
        ModelSync();
    }
示例#17
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     scoreLabel    = (Label)GetParent().FindNode("score_label");
     counterLabel  = (Label)GetParent().FindNode("CounterLabel");
     scoreProgress = (TextureProgress)FindNode("TextureProgress");
     goalConatiner = (HBoxContainer)FindNode("GoalContainer");
     OnUpdateScore(0);
 }
示例#18
0
    public override void _Ready()
    {
        progress = GetNode <TextureProgress>("TextureProgress");
        tween    = GetNode <Tween>("Tween");

        Signals.Instance.Connect("CollectingResource", this, nameof(OnCollectingResource));
        Signals.Instance.Connect("NotCollectingResource", this, nameof(OnNotCollectingResource));
        this.Hide();
    }
示例#19
0
    public override void _Ready()
    {
        Events.dinoDeployed += OnDinoDeployed;

        dinoTimer = (Timer)FindNode("Timer");
        progress  = (TextureProgress)FindNode("TextureProgress");
        tween     = (Tween)FindNode("Tween");

        progress.Hide();
    }
    public override void _Ready()
    {
        _owner = GetParent() as BaseEnemy;
        _cover = GetNode("cover") as TextureProgress;

        _owner.HealthChangedEvent += UpdateValue;
        _owner.OwnDeathEvent      += QueueFree;
        SetValue(1);
        Hide();
    }
示例#21
0
    public override void _Ready()
    {
        _bar         = (TextureProgress)GetNode("Bars/LifeBar/TextureProgress");
        _tween       = (Tween)GetNode("Tween");
        _numberLabel = (Label)GetNode("Bars/LifeBar/Count/Background/Number");
        var player = (Player)GetNode("../Characters/Player");

        _bar.MaxValue   = player.MaxHealth;
        _animatedHealth = player.MaxHealth;
    }
示例#22
0
        private void OnTweenComplete(TextureProgress obj, NodePath key)
        {
            loseLayer.Value = 0;
            gainLayer.Value = 0;

            if (hideWhenFull && baseLayer.Value == 100)
            {
                Hide();
            }
        }
示例#23
0
        public override void _Ready()
        {
            _progressBar        = GetNode <ProgressBar>("ProgressBar");
            _textureProgressBar = GetNode <TextureProgress>("TextureProgress");
            _styleBoxFlat       = _progressBar.GetStylebox("fg") as StyleBoxFlat;
            _defaultColor       = _styleBoxFlat.BgColor;

            _textureProgressBar.Visible = _progressType == 1;
            _progressBar.Visible        = _progressType == 0;
        }
示例#24
0
    public override void _Ready()
    {
        base._Ready();
        _hpBar  = GetNode <TextureProgress>("HpBar");
        _global = GetTree().Root.GetNode <Global>("Global");

        Damage = StartDamage + (int)Math.Sqrt(_global.Level * 5);
        Speed  = StartSpeed + (int)Math.Sqrt(_global.Level * 50);
        _healthNode.SetHealth(StartHp + (int)Math.Sqrt(_global.Level * 150));
        _reloadTimer.WaitTime = 0.1f;
    }
示例#25
0
    public override void _Ready()
    {
        Visible = false;

        progress = GetNode <TextureProgress>("TextureProgress");
        Root     = GetTree().Root;

        tween = new Tween();

        currentScene = Root.GetChild(Root.GetChildCount() - 1);
    }
示例#26
0
    /*
     *  Quick overview of signalling in Godot:
     *  In signal dispatching class:
     *          AddUserSignal("dec_local_health");  - establishes signal
     *          EmitSignal("dec_local_health");		- emit the signal
     *  In signal receiving class:
     *          DispatchingClass.Connect("dec_local_health", this, nameof(MethodToCall));
     */

    public override void _Ready()
    {
        _bar = (TextureProgress)GetNode("HBoxContainer/Bars/Bar/Health/TextureProgress");

        // _ready() is called for children before parent
        localPlayer   = (Tank)GetTree().GetRoot().FindNode(GetTree().GetNetworkUniqueId().ToString(), true, false);
        _bar.MaxValue = localPlayer.getMaxHealth();
        _bar.Value    = _bar.MaxValue;
        localPlayer.Connect("dec_local_health", this, nameof(DecrementBar));
        localPlayer.Connect("respawn", this, nameof(ResetBar));
    }
示例#27
0
 public void Load()
 {
     barRed    = (Texture)GD.Load("res://Assets/UI/barHorizontal_red_mid 200.png");
     barYellow = (Texture)GD.Load("res://Assets/UI/barHorizontal_yellow_mid 200.png");
     barGreen  = (Texture)GD.Load("res://Assets/UI/barHorizontal_green_mid 200.png");
     healthBar = (TextureProgress)GetNode("Margin/Container/HealthBar");
     ammoBar   = (TextureProgress)GetNode("Margin/Container/AmmoBar");
     tween     = (Tween)healthBar.GetNode("Tween");
     anim      = (AnimationPlayer)GetNode("AnimationPlayer");
     anim.Connect("animation_finished", this, "AnimationFinished");
     player = GetNode <Player>("../Player");
 }
示例#28
0
    public static void SmoothlyUpdateBar(TextureProgress bar, float target, float delta)
    {
        if (delta <= 0)
        {
            GD.PrintErr("Tried to run SmoothlyUpdateBar with non-positive delta!");
            return;
        }

        var weight = Math.Min(3.0f * delta + 0.2f, 1.0f);

        bar.Value = MathUtils.Lerp((float)bar.Value, target, weight, 1.0f / (float)bar.MaxValue);
    }
示例#29
0
    public override void _Ready()
    {
        _alchemy        = GetParent().GetParent <Alchemy>();
        _mortarSplash   = GetParent().GetNode <Particles2D>("Crush/MortarSplash");
        _pestle         = GetParent().GetNode <Pestle>("Pestle");
        _potionCircle   = GetParent().GetNode <PotionCircle>("Crush/PotionCircle");
        _potionProgress = GetParent().GetNode <TextureProgress>("Crush/PotionProgress");

        _mortarSplashBurst = GD.Load <PackedScene>("res://particle/MortarSplashBurst.tscn");

        _pestle.Connect("body_entered", this, nameof(_OnPestleBodyEntered));
    }
示例#30
0
 /// <summary>Assigns all controls to local variables for easy use.</summary>
 private void AssignControls()
 {
     BtnCharacter  = (Button)FindNode("BtnCharacter");
     BtnSettings   = (Button)FindNode("BtnSettings");
     BtnHelp       = (Button)FindNode("BtnHelp");
     LblLevel      = (Label)GetNode("LblLevel");
     LblExperience = (Label)GetNode("LblExperience");
     LblGold       = (Label)GetNode("LblGold");
     LblText       = (Label)GetNode("LblText");
     TPHealth      = (TextureProgress)GetNode("TPHealth");
     TPMagic       = (TextureProgress)GetNode("TPMagic");
 }