【a】可视化剧本编辑器 10.StoryEditor
This commit is contained in:
43
Assets/10.StoryEditor/RunTime/Player/Node/BeginNodePlayer.cs
Normal file
43
Assets/10.StoryEditor/RunTime/Player/Node/BeginNodePlayer.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stary.Evo.StoryEditor
|
||||
{
|
||||
public class BeginNodePlayer : NodePlayer
|
||||
{
|
||||
public new BeginNodeData Data;
|
||||
public List<NodePlayer> Next = new();
|
||||
|
||||
public BeginNodePlayer(GraphPlayer graph, BeginNodeData data) : base(graph, data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public override bool Connect()
|
||||
{
|
||||
Debug.Log("BeginNodePlayer: Connect");
|
||||
if (!base.Connect())
|
||||
return false;
|
||||
|
||||
Data.next.ForEach(index => Next.Add(Graph.Nodes[index]));
|
||||
Next.ForEach(node => node.Connect());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async UniTask Execute()
|
||||
{
|
||||
Init();
|
||||
Debug.Log($"开始执行剧本: {Graph.Name}");
|
||||
await base.Execute();
|
||||
await MoveNext();
|
||||
}
|
||||
|
||||
public override UniTask MoveNext()
|
||||
{
|
||||
Next.ForEach(node => node?.Execute());
|
||||
return base.MoveNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user