54 lines
978 B
C#
54 lines
978 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using EventParts;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.Collections;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Events/EventParts/EventController.cs")]
|
|
public partial class EventController : Node
|
|
{
|
|
[Export(PropertyHint.None, "")]
|
|
public Array<Entity> entities;
|
|
|
|
private List<EventPart> events;
|
|
|
|
public override void _EnterTree()
|
|
{
|
|
if (events != null)
|
|
{
|
|
return;
|
|
}
|
|
events = new List<EventPart>();
|
|
foreach (EventPart child in GetChildren())
|
|
{
|
|
events.Add(child);
|
|
}
|
|
}
|
|
|
|
public void Do()
|
|
{
|
|
Main.inEvent = Coroutine.Start(Doing());
|
|
}
|
|
|
|
private IEnumerator Doing()
|
|
{
|
|
Player.instance.StopMoving();
|
|
yield return null;
|
|
for (int i = 0; i < events.Count; i++)
|
|
{
|
|
events[i].routine = Coroutine.Start(events[i].Routine());
|
|
if (!events[i].parallel)
|
|
{
|
|
while (!events[i].routine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|