This commit is contained in:
SoulliesOfficial
2026-06-09 11:21:59 -04:00
parent 7c60c40d6b
commit 021e76efe7
493 changed files with 50500 additions and 2211 deletions

View File

@@ -0,0 +1,95 @@
using System.Collections.Generic;
using Yarn.Unity;
namespace SLSUtilities.Narrative
{
public static partial class YarnFunctions
{
[YarnCommand("set_bool")]
public static void Yarn_SetBool(string key, bool value)
{
StorySystem.Variables.boolVariables[key] = value;
}
[YarnFunction("get_bool")]
public static bool Yarn_GetBool(string key)
{
return StorySystem.Variables.boolVariables.GetValueOrDefault(key, false);
}
[YarnCommand("set_int")]
public static void Yarn_SetInt(string key, int value)
{
StorySystem.Variables.intVariables[key] = value;
}
[YarnCommand("modify_int")]
public static void Yarn_ModifyInt(string key, int modification)
{
int currentValue = StorySystem.Variables.intVariables.GetValueOrDefault(key, 0);
StorySystem.Variables.intVariables[key] = currentValue + modification;
}
[YarnFunction("get_int")]
public static int Yarn_GetInt(string key)
{
return StorySystem.Variables.intVariables.GetValueOrDefault(key, 0);
}
[YarnCommand("set_float")]
public static void Yarn_SetFloat(string key, float value)
{
StorySystem.Variables.floatVariables[key] = value;
}
[YarnCommand("modify_float")]
public static void Yarn_ModifyFloat(string key, float modification)
{
float currentValue = StorySystem.Variables.floatVariables.GetValueOrDefault(key, 0f);
StorySystem.Variables.floatVariables[key] = currentValue + modification;
}
[YarnFunction("get_float")]
public static float Yarn_GetFloat(string key)
{
return StorySystem.Variables.floatVariables.GetValueOrDefault(key, 0f);
}
[YarnCommand("set_string")]
public static void Yarn_SetString(string key, string value)
{
StorySystem.Variables.stringVariables[key] = value;
}
[YarnFunction("get_string")]
public static string Yarn_GetString(string key)
{
return StorySystem.Variables.stringVariables.GetValueOrDefault(key, "");
}
}
public static partial class YarnFunctions
{
[YarnCommand("log")]
public static void Log(string message, string logType)
{
logType = logType.ToLower();
switch (logType)
{
case "info":
UnityEngine.Debug.Log(message);
break;
case "warning":
UnityEngine.Debug.LogWarning(message);
break;
case "error":
UnityEngine.Debug.LogError(message);
break;
default:
UnityEngine.Debug.Log(message);
break;
}
}
}
}