ShanxiKnowledgeBase/SXElectricityInformationAcq.../Assets/Seal.cs

79 lines
2.3 KiB
C#

using DefaultNamespace.ProcessMode;
using MotionFramework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 盒装封印
/// </summary>
public class Seal : MonoBehaviour
{
/// <summary>
/// 盒装封印
/// </summary>
public GameObject SealObj;
/// <summary>
/// 新集中器上封印
/// </summary>
public GameObject[] Sealcol;
/// <summary>
/// 集线器封印上box碰撞体
/// </summary>
public BoxCollider[] sealbcl;
public Image EndOfProcessImage;
/// <summary>
/// 透明盖子碰撞
/// </summary>
public BoxCollider SparentoverCol;
/// <summary>
/// 柜门卡栓
/// </summary>
public GameObject CabinetDoorLatch;
// Start is called before the first frame update
void Start()
{
sealbcl[0].GetComponent<BoxCollider>().enabled = true;
sealbcl[1].GetComponent<BoxCollider>().enabled = true;
MotionEngine.GetModule<AnimationProcessManager>().OnCompleteEvent += CompleteEvent;
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{//Camera.transform.forward
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
bool raycast = Physics.Raycast(ray, out hit);
if (raycast)
{
if (hit.collider.gameObject.name == "集中器_封印_L碰撞")
{
Sealcol[0].gameObject.SetActive(true);
Debug.Log(hit.collider.gameObject.name); MotionEngine.GetModule<AnimationProcessManager>().HandleClick(hit.collider.gameObject);
}
if (hit.collider.gameObject.name == "集中器_封印R碰撞 ")
{
Sealcol[1].gameObject.SetActive(true);
CabinetDoorLatch.GetComponent<BoxCollider>().enabled = true;
SparentoverCol.GetComponent<BoxCollider>().enabled = true;
Debug.Log(hit.collider.gameObject.name); MotionEngine.GetModule<AnimationProcessManager>().HandleClick(hit.collider.gameObject);
}
}
}
}
private void CompleteEvent()
{
EndOfProcessImage.gameObject.SetActive(true);
Debug.Log("流程结束");
}
}