143 lines
3.2 KiB
C#
143 lines
3.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HighlightingSystem;
|
|
public class FlowControlBase : MonoBehaviour
|
|
{
|
|
public 流程状态 流程状态 = 流程状态.未完成;
|
|
/// <summary>
|
|
/// 该步骤高亮提示脚本合集
|
|
/// </summary>
|
|
|
|
public GameObject[] 提示;
|
|
/// <summary>
|
|
/// 该步骤中需要完成交互的物体
|
|
/// </summary>
|
|
public FlowInterObjectBase[] 交互物体;
|
|
/// <summary>
|
|
/// 交互物体的总控父物体
|
|
/// </summary>
|
|
public GameObject father;
|
|
//private List<FlowInterObjectBase> 已完成交互;
|
|
/// <summary>
|
|
/// 该步骤的分值
|
|
/// </summary>
|
|
public int 步骤分值 =0;
|
|
/// <summary>
|
|
/// 已完成步骤数
|
|
/// </summary>
|
|
public int 步骤数 = 0;
|
|
/// <summary>
|
|
/// 只进行一次的阶段控制开关
|
|
/// </summary>
|
|
[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<HighlightingSystem.Highlighter>())
|
|
{
|
|
提示[i].GetComponent<HighlightingSystem.Highlighter>().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<HighlightingSystem.Highlighter>())
|
|
{
|
|
提示[i].GetComponent<HighlightingSystem.Highlighter>().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()
|
|
{
|
|
流程状态 = 流程状态.已完成;
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|