2021-07-04 01:00:01 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2021-08-18 00:50:19 +08:00
|
|
|
using UnityEditor;
|
2021-07-04 01:00:01 +08:00
|
|
|
|
|
|
|
public class AllLinesInfo : MonoBehaviour
|
|
|
|
{
|
2021-08-07 01:31:29 +08:00
|
|
|
//总线信息类,用来存储场景中电话线断裂的总体信息,
|
2021-07-04 01:00:01 +08:00
|
|
|
// Start is called before the first frame update
|
2021-09-07 16:43:58 +08:00
|
|
|
[SerializeField]
|
2021-08-18 00:50:19 +08:00
|
|
|
private int needCount;
|
2021-07-04 01:00:01 +08:00
|
|
|
public int OKCount = 0;
|
2021-09-10 22:17:49 +08:00
|
|
|
private bool hasPlayed = false;//是否已经触发过修完事件
|
|
|
|
[Tooltip("请拖入修完所有电线后的事件")]
|
|
|
|
public Event endEvent;
|
2021-07-04 01:00:01 +08:00
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
needCount = transform.childCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
2021-09-10 22:17:49 +08:00
|
|
|
if(needCount == OKCount && !hasPlayed)//如果数值表示修完并且没有触发过结束事件
|
|
|
|
{
|
|
|
|
if(endEvent != null)endEvent.OnCall();//触发结束事件
|
|
|
|
hasPlayed = true;//标记为已经触发过结束事件
|
|
|
|
}
|
2021-07-04 01:00:01 +08:00
|
|
|
}
|
2021-08-07 01:31:29 +08:00
|
|
|
|
|
|
|
public bool AreYouOK(){return (needCount == OKCount);}//返回完成量是不是等于需求量
|
2021-08-18 00:50:19 +08:00
|
|
|
|
2021-07-04 01:00:01 +08:00
|
|
|
}
|