示例#1
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;
    }
示例#2
0
    void UpdateProgressBar(Enums.Dinos dinoType)
    {
        progress.Show();

        float delay = DinoInfo.Instance.GetDinoTimerDelay(dinoType);

        tween.InterpolateProperty(
            progress, "value", 0, 100, delay
            );
        tween.Start();
    }
 public void UpdateHealthBar(float value)
 {
     healthBar.TextureProgress_ = barGreen;
     if (value < 60)
     {
         healthBar.TextureProgress_ = barYellow;
     }
     if (value < 25)
     {
         healthBar.TextureProgress_ = barRed;
     }
     if (value < 100)
     {
         healthBar.Show();
     }
     healthBar.Value = value;
 }
示例#4
0
    public void _updateHealthBar(int value)
    {
        barTexture = barGreen;
        TextureProgress healthBar = (TextureProgress)GetNode("HealthBar");

        if (value < 100)
        {
            healthBar.Show();
        }

        if (value < 25)
        {
            barTexture = barRed;
        }
        else if (value < 60)
        {
            barTexture = barYellow;
        }



        healthBar.Value            = value;
        healthBar.TextureProgress_ = barTexture;
    }