feat: add ScriptManager for VN Gaming

This commit is contained in:
2025-11-26 04:54:51 +09:00
parent 090f9da990
commit d7c5f3113a
11 changed files with 396 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
using UnityEngine;
public class Script
{
private List<ScriptAction> _actions;
private int _currentIndex = -1;
private Dictionary<string, int> _sceneMap = new Dictionary<string, int>();
public Script(List<ScriptAction> actions, Dictionary<string, int> sceneMap)
{
_actions = actions;
_sceneMap = sceneMap;
_currentIndex = -1;
}
public bool HasNextAction()
{
return _currentIndex < _actions.Count - 1;
}
public ScriptAction Continue()
{
if (!HasNextAction())
return null;
_currentIndex++;
ScriptAction currentAction = _actions[_currentIndex];
return currentAction;
}
public ScriptAction GetCurrent()
{
if (_currentIndex >= 0 && _currentIndex < _actions.Count)
return _actions[_currentIndex];
return null;
}
public void JumpTo(string sceneName)
{
_currentIndex = _sceneMap[sceneName] - 1; // Continue() 호출 시 해당 인덱스가 되도록 -1
Debug.Log($"Script :: Jump to scene: {sceneName} (Index: {_currentIndex + 1})");
}
}