using System.Collections; using System.Collections.Generic; using UnityEngine; using HighlightingSystem; public class FlowControlBase : MonoBehaviour { public 流程状态 流程状态 = 流程状态.未完成; /// /// 该步骤高亮提示脚本合集 /// public GameObject[] 提示; /// /// 该步骤中需要完成交互的物体 /// public FlowInterObjectBase[] 交互物体; /// /// 交互物体的总控父物体 /// public GameObject father; //private List 已完成交互; /// /// 该步骤的分值 /// public int 步骤分值 =0; /// /// 已完成步骤数 /// public int 步骤数 = 0; /// /// 只进行一次的阶段控制开关 /// [HideInInspector] public bool first = true; public bool 提示ON = false; // Start is called before the first frame update // Update is called once per frame public virtual void reset() { 流程状态 = 流程状态.未完成; father.SetActive(false); for (int i = 0; i < 提示.Length; i++) {if (提示[i].GetComponent()) { 提示[i].GetComponent().constant = false; // Debug.Log("触发"); if (提示[i].name == "高亮") { 提示[i].SetActive(false); } } else { 提示[i].SetActive(false); //Debug.Log("触发"); } } for (int i = 0; i < 交互物体.Length; i++) { 交互物体[i].交互完成 = false; 交互物体[i].first = true; } } public virtual void Enter() { father.SetActive(true) ; if (提示ON == true) { for (int i = 0; i < 提示.Length; i++) { if (提示[i].GetComponent()) { 提示[i].GetComponent().constant = true; // Debug.Log("触发"); if (提示[i].name == "高亮") { 提示[i].SetActive(true); } } else { 提示[i].SetActive(true); //Debug.Log("触发"); } } } 流程状态 = 流程状态.进行中; } public virtual void Update() { if (流程状态 == 流程状态.进行中) { for (int i = 0; i < 交互物体.Length; i++) { if (交互物体[i].交互完成 == true && 交互物体[i].first == true) { 步骤分值 += 交互物体[i].小步分值; 步骤数+=1; 交互物体[i].first = false; } } if (步骤数 == 交互物体.Length) { Complete(); } } } public virtual void Complete() { 流程状态 = 流程状态.已完成; } }