YanCheng_Metrology/Assets/Scripts/Project/CXX/StepState.cs

52 lines
1.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
/// <summary>
/// 步骤状态(管理一个步骤下的所有需要初始化的状态)
/// </summary>
public class StepState : MonoBehaviour
{
/// <summary>
/// 步骤所处场景
/// </summary>
public E_SceneType initSceneType;
[HideInInspector]
public int systemId;
[HideInInspector]
public int schemeId;
[HideInInspector]
public int subProcessId;
public List<StepStateBase> stepStateBases;
private Action<E_SceneType> callback;
public void Init()
{
stepStateBases = transform.GetComponentsInChildren<StepStateBase>(true).ToList();
subProcessId = int.Parse(gameObject.name);
schemeId = int.Parse(transform.parent.name);
systemId= int.Parse(transform.parent.parent.name);
}
/// <summary>
/// 注册场景跳转回调
/// </summary>
/// <param name="callback"></param>
public void AddResetChangeScene(Action<E_SceneType> callback)
{
this.callback = callback;
}
public void InvokeChangeScene()
{
if (callback != null)
{
callback(initSceneType);
};
}
}