Refactor hut tier definitions to use images and scales instead of scene paths; add moddable visual component
This commit is contained in:
28
Scripts/Components/ModdableVisual.cs
Normal file
28
Scripts/Components/ModdableVisual.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Godot;
|
||||
|
||||
namespace ParasiticGod.Scripts.Components;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ModdableVisual : Node2D
|
||||
{
|
||||
[Export] private Sprite2D _sprite;
|
||||
public Follower.FollowerTier Tier { get; private set; }
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
if (_sprite != null)
|
||||
{
|
||||
_sprite.Texture = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(Follower.FollowerTier tier, Texture2D texture, Vector2 scale)
|
||||
{
|
||||
Tier = tier;
|
||||
if (_sprite != null && texture != null)
|
||||
{
|
||||
_sprite.Texture = texture;
|
||||
_sprite.Scale = scale;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user