84 lines
1.7 KiB
C#
84 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class FlowControlManager : MonoBehaviour
|
|
{
|
|
public int index;
|
|
public List<FlowControlBase> 步骤合集 = new List<FlowControlBase>();
|
|
|
|
public bool 开启提示;
|
|
private int oldindex;
|
|
private int checkindex;
|
|
public int 总得分 = 0;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
foreach (var item in GetComponentsInChildren<FlowControlBase>())
|
|
{
|
|
步骤合集.Add(item);
|
|
}
|
|
for (int i = 0; i < 步骤合集.Count; i++)
|
|
{
|
|
步骤合集[i].reset();
|
|
}
|
|
if (开启提示 == true)
|
|
{
|
|
for (int i = 0; i < 步骤合集.Count; i++)
|
|
{
|
|
步骤合集[i].提示ON = true;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
nodechange();
|
|
if (步骤合集[index].流程状态 == 流程状态.进行中)
|
|
{
|
|
步骤合集[index].Update();
|
|
|
|
}
|
|
NextNode();
|
|
|
|
}
|
|
/// <summary>
|
|
/// 切换步骤
|
|
/// </summary>
|
|
public void nodechange() {
|
|
|
|
|
|
if (步骤合集[index].first == true)
|
|
{
|
|
步骤合集[index].reset();
|
|
步骤合集[index].Enter();
|
|
// Debug.Log("触发1");
|
|
步骤合集[index].first = false;
|
|
|
|
}
|
|
|
|
}
|
|
public void NextNode() {
|
|
|
|
|
|
if (步骤合集[index].流程状态 == 流程状态.已完成)
|
|
{
|
|
总得分 += 步骤合集[index].步骤分值;
|
|
步骤合集[index].reset();
|
|
index = index+=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
/// <summary>
|
|
/// 侦测步骤变化
|
|
/// </summary>
|
|
|
|
}
|