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.
49 lines
1.2 KiB
49 lines
1.2 KiB
using System.Diagnostics;
|
|
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.Fight;
|
|
|
|
public partial class PathSetup : Node
|
|
{
|
|
[Export] private int pathId;
|
|
|
|
[ExportCategory("Variants")] [Export] private CanvasItem closedVariant;
|
|
[Export] private CanvasItem nextRoomVariant;
|
|
|
|
public override void _Ready()
|
|
{
|
|
SetupPathVariant();
|
|
}
|
|
|
|
private void SetupPathVariant()
|
|
{
|
|
Debug.Assert(FightWorld.Instance.currentRoom != null);
|
|
if (FightWorld.Instance.currentRoom.paths.TryGetValue(pathId, out var nextRoom))
|
|
{
|
|
ShowOnlyVariant(nextRoomVariant);
|
|
}
|
|
else
|
|
{
|
|
ShowOnlyVariant(closedVariant);
|
|
}
|
|
}
|
|
|
|
private void ShowOnlyVariant(CanvasItem variantToShow)
|
|
{
|
|
HideVariant(closedVariant);
|
|
HideVariant(nextRoomVariant);
|
|
ShowVariant(variantToShow);
|
|
}
|
|
|
|
private void ShowVariant(CanvasItem variant)
|
|
{
|
|
variant.Visible = true;
|
|
variant.ProcessMode = ProcessModeEnum.Always;
|
|
}
|
|
|
|
private void HideVariant(CanvasItem variant)
|
|
{
|
|
variant.Visible = false;
|
|
variant.ProcessMode = ProcessModeEnum.Disabled;
|
|
}
|
|
} |