You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Babushka/scripts/CSharp/Common/SpriteSwitcher.cs

36 lines
659 B

using Godot;
namespace Babushka.scripts.CSharp.Common;
/// <summary>
/// Switches between two Sprite Options.
/// </summary>
public partial class SpriteSwitcher : Node3D
{
[Export] private Sprite3D _TrueSprite;
[Export] private Sprite3D _FalseSprite;
[Export] private bool _state = true;
public override void _Ready()
{
SetState();
}
public void SwitchState()
{
_state = !_state;
SetState();
}
private void SetState()
{
if (_state)
{
_TrueSprite.Visible = true;
}
else
{
_FalseSprite.Visible = false;
}
}
}