Made basic quest setup

This commit is contained in:
cblech
2025-07-07 04:40:40 +02:00
parent ba512508f8
commit 01daddee3b
28 changed files with 392 additions and 0 deletions
@@ -0,0 +1,26 @@
using System;
using Godot;
namespace Babushka.scripts.CSharp.Common.Util;
public static class NodeExtension
{
/// <summary>
/// Searches for a parent node of the specified type.
/// </summary>
/// <typeparam name="T">The type of the parent node to search for. The search is successful, when <code>searchedNode is T</code></typeparam>
/// <param name="self">The node from which to start the search.</param>
/// <returns>The parent node of type T if found, otherwise throws an exception.</returns>
public static T FindParentByType<T>(this Node self)
{
var parent = self.GetParent();
while (parent != null)
{
if (parent is T tParent)
{
return tParent;
}
parent = parent.GetParent();
}
throw new Exception($"Parent of type {typeof(T)} not found for node {self.Name}");
}
}
@@ -0,0 +1 @@
uid://bwisbh2f2ci6l