using Godot; namespace Babushka.scripts.CSharp.Common; /// /// Switches between two available Sprite Options. /// public partial class SpriteSwitcher2D : Node2D { [Export] private Sprite2D _activeSprite; [Export] private Sprite2D _inactiveSprite; [Export] private bool _active = false; public override void _Ready() { SetSprites(); } /// /// Switches the State of the Sprites to the opposite. /// Emits Switch Signal. /// public void SwitchState(bool state) { _active = state; SetSprites(); } private void SetSprites() { if(_activeSprite != null) _activeSprite.Visible = _active; if(_inactiveSprite != null) _inactiveSprite.Visible = !_active; } }