27 lines
706 B
C#
27 lines
706 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class PlayerUi : CanvasLayer
|
|
{
|
|
private TextureRect[] _dashIcons = new TextureRect[3];
|
|
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
|
|
_dashIcons[0] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash1");
|
|
_dashIcons[1] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash2");
|
|
_dashIcons[2] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash3");
|
|
}
|
|
|
|
public void SetNumberOfDashesLeft(int numberOfDashes)
|
|
{
|
|
int index = 1;
|
|
foreach (var dashIcon in _dashIcons)
|
|
{
|
|
dashIcon.SetVisible(index <= numberOfDashes);
|
|
index++;
|
|
}
|
|
}
|
|
}
|