♻️ migrated the InteractionAreas currently used to the new format and removed the old code
This commit is contained in:
@@ -7,13 +7,13 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
||||
|
||||
public partial class InteractionArea2D : Node2D
|
||||
{
|
||||
|
||||
[Export] private Area2D _area;
|
||||
[Export] private Label _label;
|
||||
[Export] private bool _active = true;
|
||||
[Export] private bool _useOutline = true;
|
||||
[Export] private ShaderMaterial _outlineMaterial;
|
||||
[Export] private CanvasItem? _spriteToOutline; // keep to not break old usages. TODO: remove later
|
||||
[Export] private CanvasItem[] _spritesToOutline;
|
||||
[Export] private CanvasItem[] _spritesToOutline = [];
|
||||
[Export] private bool _showLabel = true;
|
||||
[Export] private int _id = -1; // TODO: remove
|
||||
|
||||
@@ -38,21 +38,7 @@ public partial class InteractionArea2D : Node2D
|
||||
{
|
||||
if (_useOutline)
|
||||
{
|
||||
try
|
||||
{
|
||||
// support old implementations of the script. If the sprite to outline is set, add it to the array
|
||||
if (_spriteToOutline != null)
|
||||
{
|
||||
Array.Resize(ref _spritesToOutline, _spritesToOutline.Length + 1);
|
||||
_spritesToOutline[^1] = _spriteToOutline;
|
||||
}
|
||||
|
||||
_backupMaterials = _spritesToOutline.Select(s => s.Material).ToArray();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
GD.PrintErr($"No sprite to outline found on: {GetParent().Name}" + exception.Message);
|
||||
}
|
||||
_backupMaterials = _spritesToOutline.Select(s => s.Material).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user