1717 lines
59 KiB
C#
1717 lines
59 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.Playables;
|
|||
|
|
using ZXK.Framework;
|
|||
|
|
using ZXK.UTility;
|
|||
|
|
using DG.Tweening;
|
|||
|
|
using HighlightingSystem;
|
|||
|
|
using NPOI.HSSF.Record;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
using ZXKFramework;
|
|||
|
|
|
|||
|
|
/*******************************************************************************
|
|||
|
|
*Create By CG
|
|||
|
|
*Function 场景中模型资源控制
|
|||
|
|
*******************************************************************************/
|
|||
|
|
namespace ZXK.BYSS
|
|||
|
|
{
|
|||
|
|
public class PracticeAndExamInSceneCtrl : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
//组装
|
|||
|
|
//临时工具箱
|
|||
|
|
public Transform _ToolsTemp = null;
|
|||
|
|
|
|||
|
|
////搬运输送中气动手指模拟组装的时候在一起,播动画的时候分开
|
|||
|
|
//public Transform[] _handsTemp = null;
|
|||
|
|
|
|||
|
|
//在场房中,其五个带有线动画的模型
|
|||
|
|
[SerializeField]
|
|||
|
|
private GameObject[] _hideLineCtrls;
|
|||
|
|
|
|||
|
|
//每次拖拽工具的时候用到的模型
|
|||
|
|
public List<GameObject> _toolPrefab = new List<GameObject>();
|
|||
|
|
|
|||
|
|
public GameObject[] _zhuZhuangHide = new GameObject[] { };
|
|||
|
|
|
|||
|
|
//每次会显示的零件
|
|||
|
|
// [Header("每次会显示的零件")]
|
|||
|
|
public ItemModelCtrl[] _partModel = null;
|
|||
|
|
|
|||
|
|
//连线
|
|||
|
|
public ConnectLineCtrl _connectLineCtrl = null;
|
|||
|
|
|
|||
|
|
//充气
|
|||
|
|
private bool _gasing = false;
|
|||
|
|
private bool _stopGasAble = false;
|
|||
|
|
|
|||
|
|
public AnmCtrl _anmCtrl = null;
|
|||
|
|
|
|||
|
|
//运行
|
|||
|
|
private Transform _startBtnTran = null;
|
|||
|
|
private Transform _stopBtnTran = null;
|
|||
|
|
private Transform _rsetBtnTran = null;
|
|||
|
|
private Transform _urgentStopBtnTran = null;
|
|||
|
|
public Transform _AutoBtnTran = null;
|
|||
|
|
private int _anmState = -1;
|
|||
|
|
|
|||
|
|
[Header("音频管理器")]
|
|||
|
|
public SpeakManager speakManager;
|
|||
|
|
private void Awake()
|
|||
|
|
{
|
|||
|
|
//搬运输送模式
|
|||
|
|
if (transform.name == "搬运输送控制虚拟仿真系统" && AppManagement.Instance._CurType == EnumCtrl.Type.BYSS)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//搬运输送模式,设备运行模式显示新的模型
|
|||
|
|
ByssModel1.gameObject.SetActive(true);
|
|||
|
|
ByssModel2.gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
AppManagement._ImgDataArray = new Dictionary<string, System.IO.Stream>();
|
|||
|
|
}
|
|||
|
|
private void Start()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (transform.GetComponent<SpeakManager>())
|
|||
|
|
{
|
|||
|
|
//设置音频管理器
|
|||
|
|
speakManager = transform.GetComponent<SpeakManager>();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//通用设置
|
|||
|
|
|
|||
|
|
if (EnumCtrl.GetEnumDescription(AppManagement.Instance._CurType).Equals(transform.name))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
_connectLineCtrl = transform.GetComponent<ConnectLineCtrl>();
|
|||
|
|
_anmCtrl = transform.GetComponentInChildren<AnmCtrl>();
|
|||
|
|
|
|||
|
|
UI_Manage.Instance.GetPanel("PracticeAndExamPanel").GetComponent<PracticeAndExamPanel>()
|
|||
|
|
._CurTrainExamSceneCtrl = this;
|
|||
|
|
AppManagement.Instance._GasScore = 0;
|
|||
|
|
}
|
|||
|
|
if(AppManagement.Instance._CurType == UTility.EnumCtrl.Type.XHBY && transform.name == "循环搬运机械手虚拟仿真系统")
|
|||
|
|
{
|
|||
|
|
ShowFirstGeo();
|
|||
|
|
}
|
|||
|
|
//智能运动模块设置
|
|||
|
|
if(AppManagement.Instance._CurType == UTility.EnumCtrl.Type.ZNYD && transform.name == "智能运动控制虚拟仿真系统")
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < _hideLineCtrls.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (!_hideLineCtrls[i].transform.name.Equals("智能运动控制虚拟仿真系统"))
|
|||
|
|
{
|
|||
|
|
foreach (BezierPipe t in _hideLineCtrls[i].GetComponentsInChildren<BezierPipe>())
|
|||
|
|
{
|
|||
|
|
Destroy(t);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//如果是气动冲压模块
|
|||
|
|
if (AppManagement.Instance._CurType == UTility.EnumCtrl.Type.QDCY && transform.name == "气动冲压控制虚拟仿真系统")
|
|||
|
|
{
|
|||
|
|
//拿到按钮的默认状态
|
|||
|
|
Get_QDCYBtn_State();
|
|||
|
|
//自动模式绿灯亮,手动模式黄灯亮
|
|||
|
|
QDCY_YellowLight.GetComponent<MeshRenderer>().material = QDCY_YellowLightMat;
|
|||
|
|
QDCY_GreenLight.GetComponent<MeshRenderer>().material = QDCY_DefaultMaterial;
|
|||
|
|
|
|||
|
|
Is_QDCY_BtnShouDong = true;
|
|||
|
|
ShowFirstGeo();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//判断材料分解模块,设备运行的时候,落料塔显示
|
|||
|
|
//其他模式落料塔隐藏
|
|||
|
|
if (transform.name == "材料分拣虚拟仿真系统" && AppManagement.Instance._CurType == EnumCtrl.Type.CLFJ)
|
|||
|
|
{
|
|||
|
|
//拿到按钮的默认状态
|
|||
|
|
OnGetReSet();
|
|||
|
|
|
|||
|
|
if (AppManagement.Instance._CurModel == EnumCtrl.Model.Running)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//落料塔显示,其他模式隐藏
|
|||
|
|
CLFJ_LuoLiaoTa2.gameObject.SetActive(false);
|
|||
|
|
CLFJ_LuoLiaoTa3.gameObject.SetActive(false);
|
|||
|
|
//设置初始状态
|
|||
|
|
//点击急停按钮的次数
|
|||
|
|
Click_CLFJ_UrgentStopNum = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CLFJ_LuoLiaoTa2.gameObject.SetActive(false);
|
|||
|
|
CLFJ_LuoLiaoTa3.gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
ShowFirstGeo();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//搬运输送模式
|
|||
|
|
if (transform.name == "搬运输送控制虚拟仿真系统" && AppManagement.Instance._CurType == EnumCtrl.Type.BYSS)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//搬运输送模式,设备运行模式显示新的模型
|
|||
|
|
ByssModel1.gameObject.SetActive(true);
|
|||
|
|
ByssModel2.gameObject.SetActive(false);
|
|||
|
|
//显示屏幕设置
|
|||
|
|
PingMu01.gameObject.SetActive(true);
|
|||
|
|
PingMu02.gameObject.SetActive(false);
|
|||
|
|
|
|||
|
|
|
|||
|
|
for (int i = 0; i < _hideLineCtrls.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (!_hideLineCtrls[i].transform.name.Equals("搬运输送控制虚拟仿真系统"))
|
|||
|
|
{
|
|||
|
|
foreach (BezierPipe t in _hideLineCtrls[i].GetComponentsInChildren<BezierPipe>())
|
|||
|
|
{
|
|||
|
|
Destroy(t);
|
|||
|
|
//t.gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//准备组装阶段,隐藏其他物体
|
|||
|
|
for (int a = 0; a < _zhuZhuangHide.Length; a++)
|
|||
|
|
{
|
|||
|
|
_zhuZhuangHide[a].SetActive(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//组装模式
|
|||
|
|
//隐藏其他的安装部件
|
|||
|
|
//默认第一个显示
|
|||
|
|
for (int i = 0; i < _partModel.Length; i++)
|
|||
|
|
{
|
|||
|
|
_partModel[i].gameObject.SetActive(true);
|
|||
|
|
_partModel[i].DefaultAlphaState();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
for (int i = 0; i < _partModel.Length; i++)
|
|||
|
|
{
|
|||
|
|
_partModel[i].gameObject.SetActive(false);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_partModel[0].gameObject.SetActive(true);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//初始模式关闭闪烁
|
|||
|
|
Set_QiBengSwitchs_HighLight_Off();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ShowFirstGeo()
|
|||
|
|
{
|
|||
|
|
for (int a = 0; a < _zhuZhuangHide.Length; a++)
|
|||
|
|
{
|
|||
|
|
_zhuZhuangHide[a].SetActive(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//组装模式
|
|||
|
|
//隐藏其他的安装部件
|
|||
|
|
//默认第一个显示
|
|||
|
|
for (int i = 0; i < _partModel.Length; i++)
|
|||
|
|
{
|
|||
|
|
_partModel[i].gameObject.SetActive(true);
|
|||
|
|
_partModel[i].DefaultAlphaState();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
for (int i = 0; i < _partModel.Length; i++)
|
|||
|
|
{
|
|||
|
|
_partModel[i].gameObject.SetActive(false);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_partModel[0].gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void Update()
|
|||
|
|
{
|
|||
|
|
if (!EnumCtrl.GetEnumDescription(AppManagement.Instance._CurType).Equals(transform.name)) return;
|
|||
|
|
if (UI_Manage.Instance.GetPanel("PracticeAndExamPanel"))
|
|||
|
|
{
|
|||
|
|
if(UI_Manage.Instance.GetPanel("PracticeAndExamPanel").GetComponent<PracticeAndExamPanel>()
|
|||
|
|
._CurTrainExamSceneCtrl == null)
|
|||
|
|
{
|
|||
|
|
UI_Manage.Instance.GetPanel("PracticeAndExamPanel").GetComponent<PracticeAndExamPanel>()
|
|||
|
|
._CurTrainExamSceneCtrl = this;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (Input.GetMouseButtonDown(0))
|
|||
|
|
{
|
|||
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|||
|
|
RaycastHit rayHit;
|
|||
|
|
|
|||
|
|
if (PopUpMng._TriAble && Physics.Raycast(ray, out rayHit, Mathf.Infinity,
|
|||
|
|
1 << LayerMask.NameToLayer(ConstCtrl.LAYER_TERMINAL)))
|
|||
|
|
{
|
|||
|
|
if (AppManagement.Instance._CurModel == EnumCtrl.Model.Line)
|
|||
|
|
{
|
|||
|
|
_connectLineCtrl.InteractionInScene(rayHit);
|
|||
|
|
}
|
|||
|
|
else if (AppManagement.Instance._CurModel == EnumCtrl.Model.Gas)
|
|||
|
|
{
|
|||
|
|
GasInteraction(rayHit);
|
|||
|
|
}
|
|||
|
|
else if (AppManagement.Instance._CurModel == EnumCtrl.Model.Running)
|
|||
|
|
{
|
|||
|
|
RunningInteraction(rayHit);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//气动冲压模式,手动自动动画设置
|
|||
|
|
if (AppManagement.Instance._CurType == EnumCtrl.Type.QDCY &&
|
|||
|
|
AppManagement.Instance._CurModel == EnumCtrl.Model.Running &&
|
|||
|
|
Is_QDCY_BtnShouDong && IsBtnStop == false) {
|
|||
|
|
|
|||
|
|
//用来判断气动冲压手动或者自动模式,自动播放机器动画
|
|||
|
|
Switch_QDCY_Module();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 充气系统模块-最佳视角
|
|||
|
|
|
|||
|
|
[Header("充气模块_最佳视角")] public GameObject BestViewCamera;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 充气模块
|
|||
|
|
/// 刚运行的时候调用
|
|||
|
|
///将场景中的摄像机,设置为最佳视角
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_ChongQi_CameraPos()
|
|||
|
|
{
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.position = BestViewCamera.transform.position;
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.rotation = BestViewCamera.transform.rotation;
|
|||
|
|
Camera.main.fieldOfView = 60f; //调整相机FOV
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 充气
|
|||
|
|
|
|||
|
|
[Header("空压机按钮组")]
|
|||
|
|
public GameObject[] QiBengSwitchs;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设置高亮闪光
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_QiBengSwitchs_HighLight_On()
|
|||
|
|
{
|
|||
|
|
foreach (var VARIABLE in QiBengSwitchs)
|
|||
|
|
{
|
|||
|
|
var v = VARIABLE.GetComponentsInChildren<OutLineRender>();
|
|||
|
|
foreach (var it in v)
|
|||
|
|
{
|
|||
|
|
it.enabled = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void ShowAnim() {
|
|||
|
|
|
|||
|
|
//搬运输送
|
|||
|
|
//播放气泵指引动画
|
|||
|
|
|
|||
|
|
GasBtnCanvas.gameObject.SetActive(true);
|
|||
|
|
GasBtnUp.gameObject.SetActive(true);
|
|||
|
|
GasBtnDown.gameObject.SetActive(false);
|
|||
|
|
GasBtnUp.GetComponent<UGUISpriteAnimation>().FPS = 30;
|
|||
|
|
GasBtnUp.GetComponent<UGUISpriteAnimation>().Loop = true;
|
|||
|
|
GasBtnUp.GetComponent<UGUISpriteAnimation>().Play();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设置高亮不闪光
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_QiBengSwitchs_HighLight_Off()
|
|||
|
|
{
|
|||
|
|
foreach (var VARIABLE in QiBengSwitchs)
|
|||
|
|
{
|
|||
|
|
var v = VARIABLE.GetComponentsInChildren<OutLineRender>();
|
|||
|
|
foreach (var it in v)
|
|||
|
|
{
|
|||
|
|
it.enabled = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GasInteraction(RaycastHit rayHit)
|
|||
|
|
{
|
|||
|
|
//搬运输送模块的充气特殊写法
|
|||
|
|
if (AppManagement.Instance._CurType == UTility.EnumCtrl.Type.BYSS)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
BySS_ChongQi(rayHit);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (rayHit.transform.name.Equals("QiBengSwitch"))
|
|||
|
|
{
|
|||
|
|
if (_stopGasAble && _gasing)
|
|||
|
|
{
|
|||
|
|
//停止
|
|||
|
|
_anmCtrl.GasStop();
|
|||
|
|
_gasing = false;
|
|||
|
|
PopUpMng.PopCustomSucToast("提示", "恭喜您成功完成设备充气", "设备运行", () =>
|
|||
|
|
{
|
|||
|
|
if (AppManagement.Instance._CurType == EnumCtrl.Type.XHBY)
|
|||
|
|
AppManagement.Instance._GasScore += 8;
|
|||
|
|
else if (AppManagement.Instance._CurType == EnumCtrl.Type.CLFJ ||
|
|||
|
|
AppManagement.Instance._CurType == EnumCtrl.Type.ZNYD||
|
|||
|
|
AppManagement.Instance._CurType == EnumCtrl.Type.QDCY )
|
|||
|
|
AppManagement.Instance._GasScore += 4;
|
|||
|
|
AppManagement.Instance.ChangeModel(EnumCtrl.Model.Running);
|
|||
|
|
//动画指针
|
|||
|
|
_anmCtrl.ZhiZhenXiangShang();
|
|||
|
|
//修改音乐为设备运行
|
|||
|
|
if (speakManager!=null)
|
|||
|
|
{
|
|||
|
|
speakManager.Init();
|
|||
|
|
speakManager.ChangeModelAudio("设备运行");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
//关闭闪光
|
|||
|
|
Set_QiBengSwitchs_HighLight_Off();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//充气
|
|||
|
|
_anmCtrl.GasStart();
|
|||
|
|
|
|||
|
|
_gasing = true;
|
|||
|
|
_stopGasAble = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void StopGasAble()
|
|||
|
|
{
|
|||
|
|
_stopGasAble = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void AutoGas()
|
|||
|
|
{
|
|||
|
|
_anmCtrl.AutoGas();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 接线
|
|||
|
|
|
|||
|
|
public void AutoLineDir()
|
|||
|
|
{
|
|||
|
|
_connectLineCtrl.AutoLine();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 组装
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 显示当前步骤应该出现的零件
|
|||
|
|
/// </summary>
|
|||
|
|
///
|
|||
|
|
public void ShowAll(DataItemModel process)
|
|||
|
|
{
|
|||
|
|
for (int a = 0; a < _zhuZhuangHide.Length; a++)
|
|||
|
|
{
|
|||
|
|
_zhuZhuangHide[a].SetActive(true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for (int i = 0; i < _partModel.Length; i++)
|
|||
|
|
{
|
|||
|
|
_partModel[i].gameObject.SetActive(true);
|
|||
|
|
_partModel[i].DefaultAlphaState();
|
|||
|
|
_partModel[i].ShowState();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//if (_partModel[i]._ProcessName.Equals(process.ProcessName))
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public void ShowProcessPart(DataItemModel process)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
for (int i = 0; i < _partModel.Length; i++)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (_partModel[i]._ProcessName.Equals(process.ProcessName))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
_partModel[i].ShowState();
|
|||
|
|
//搬运输送模式
|
|||
|
|
//组装模式 特殊设置
|
|||
|
|
if (AppManagement.Instance._CurType == EnumCtrl.Type.BYSS
|
|||
|
|
|| AppManagement.Instance._CurType == EnumCtrl.Type.CLFJ
|
|||
|
|
|| AppManagement.Instance._CurType == EnumCtrl.Type.QDCY
|
|||
|
|
|| AppManagement.Instance._CurType == EnumCtrl.Type.XHBY)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (i==(_partModel.Length - 1))
|
|||
|
|
{//说明全部组装完成,显示隐藏的其他物体
|
|||
|
|
for (int a = 0; a < _zhuZhuangHide.Length; a++)
|
|||
|
|
{
|
|||
|
|
_zhuZhuangHide[a].SetActive(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//显示下一个
|
|||
|
|
_partModel[i + 1].gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//搬运输送
|
|||
|
|
//组装模式特殊设置
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 循环搬运机械手
|
|||
|
|
|
|||
|
|
//设备运行界面,添加一个初始视角,和按钮启动的时候添加闪烁状态
|
|||
|
|
|
|||
|
|
[Header("循环搬运机械手模块")] [Header("设备运行_初始视角")]
|
|||
|
|
public GameObject XHBY_RunningInitViewCamera;
|
|||
|
|
|
|||
|
|
[Header("循环_启动按钮")] public GameObject XHBY_StartBtn;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// 设备运行
|
|||
|
|
/// 设备运行环节初始视角调整
|
|||
|
|
/// 启动按钮闪光
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_XHBY_StartBtn_On()
|
|||
|
|
{
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.position = XHBY_RunningInitViewCamera.transform.position;
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.rotation = XHBY_RunningInitViewCamera.transform.rotation;
|
|||
|
|
Camera.main.fieldOfView = 60f; //调整相机FOV
|
|||
|
|
var v = XHBY_StartBtn.transform.GetComponentsInChildren<OutLineRender>();
|
|||
|
|
foreach (var VARIABLE in v)
|
|||
|
|
{
|
|||
|
|
VARIABLE.enabled = true;
|
|||
|
|
VARIABLE.OutLineStrength = 2;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//设置属性
|
|||
|
|
SetDefault_xhby();
|
|||
|
|
Invoke("Set_XHBY_StartBtn_Off", 2f);
|
|||
|
|
_anmCtrl.Set_XHBY_Gas();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 启动按钮关闭闪光 2秒
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_XHBY_StartBtn_Off()
|
|||
|
|
{
|
|||
|
|
var v = XHBY_StartBtn.transform.GetComponentsInChildren<OutLineRender>();
|
|||
|
|
foreach (var VARIABLE in v)
|
|||
|
|
{
|
|||
|
|
VARIABLE.enabled = false;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private bool Is_XHBY_Reset = true;
|
|||
|
|
private bool Is_XHBY_Start = false;
|
|||
|
|
|
|||
|
|
private void SetDefault_xhby() {
|
|||
|
|
|
|||
|
|
Is_XHBY_Reset = true;
|
|||
|
|
Is_XHBY_Start = false;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void XHBY_SheBeiYunXing(RaycastHit rayHit)
|
|||
|
|
{
|
|||
|
|
if (rayHit.transform == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
Debug.Log(rayHit.transform.gameObject);
|
|||
|
|
|
|||
|
|
//第一次先点击复位按钮,其他按钮不生效
|
|||
|
|
if (Is_XHBY_Reset)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//不生效
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn"))
|
|||
|
|
{
|
|||
|
|
_startBtnTran = null;
|
|||
|
|
_startBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
_stopBtnTran = null;
|
|||
|
|
_stopBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//生效
|
|||
|
|
if (rayHit.transform.name.Equals("ResetBtn"))
|
|||
|
|
{
|
|||
|
|
_rsetBtnTran = null;
|
|||
|
|
_rsetBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
|
|||
|
|
//属性设置
|
|||
|
|
Is_XHBY_Start = true;
|
|||
|
|
//设置其他属性
|
|||
|
|
Is_XHBY_Reset = false;
|
|||
|
|
|
|||
|
|
RunningPanel RunningPanel = UI_Manage.Instance.GetPanel("RunningPanel").GetComponent<RunningPanel>();
|
|||
|
|
//设置提示文字
|
|||
|
|
RunningPanel.Set_xhby_StartText();
|
|||
|
|
_anmCtrl.Play_ZDSJS_ReSet();
|
|||
|
|
speakManager.PlayFixedAudioCilp(1);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//第二次点击启动按钮
|
|||
|
|
if (Is_XHBY_Start)
|
|||
|
|
{
|
|||
|
|
Debug.Log("永远进入送料机器2状态");
|
|||
|
|
|
|||
|
|
//启动按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn"))
|
|||
|
|
{
|
|||
|
|
_startBtnTran = null;
|
|||
|
|
_startBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//设置其他属性
|
|||
|
|
Is_XHBY_Reset = false;
|
|||
|
|
Is_XHBY_Start = true;
|
|||
|
|
//设置提示文字
|
|||
|
|
RunningPanel RunningPanel = UI_Manage.Instance.GetPanel("RunningPanel").GetComponent<RunningPanel>();
|
|||
|
|
RunningPanel.Set_xhby_StartText();
|
|||
|
|
_anmCtrl.Play_XHBY_Start();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//停止按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
_stopBtnTran = null;
|
|||
|
|
_stopBtnTran = rayHit.transform;
|
|||
|
|
//无效
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
_anmCtrl.Set_XHBY_Start();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//复位按钮
|
|||
|
|
if (rayHit.transform.name.Equals("ResetBtn"))
|
|||
|
|
{
|
|||
|
|
_rsetBtnTran = null;
|
|||
|
|
_rsetBtnTran = rayHit.transform;
|
|||
|
|
//无效
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 搬运输送模块
|
|||
|
|
|
|||
|
|
[Header("下面是搬运输送模块的属性")]
|
|||
|
|
//两个气泵是否都点击了,开始充气
|
|||
|
|
public bool IsBYSS_Click1 = false;
|
|||
|
|
|
|||
|
|
public bool IsBYSS_Click2 = false;
|
|||
|
|
|
|||
|
|
//两个气泵是否都点击了,停止充气
|
|||
|
|
public bool IsBYSSChongQiStop_Click1 = false;
|
|||
|
|
public bool IsBYSSChongQiStop_Click2 = false;
|
|||
|
|
|
|||
|
|
|
|||
|
|
[Header("设备运行_初始视角")] public GameObject BYSS_RunningInitViewCamera;
|
|||
|
|
[Header("旋钮闪烁界面")]
|
|||
|
|
public GameObject XuanNiu_RedImageCanvas;
|
|||
|
|
public GameObject XuanNiu_RedImage;
|
|||
|
|
[Header("启动闪烁界面")]
|
|||
|
|
public GameObject RedImageCanvas;
|
|||
|
|
public GameObject RedImage;
|
|||
|
|
|
|||
|
|
[Header("操作界面")]
|
|||
|
|
public GameObject PingMu01;
|
|||
|
|
public GameObject PingMu02;
|
|||
|
|
public GameObject StopCanvas;
|
|||
|
|
[Header("气泵指引物体")]
|
|||
|
|
public GameObject GasBtnCanvas;
|
|||
|
|
public GameObject GasBtnUp;
|
|||
|
|
public GameObject GasBtnDown;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private bool _stopGasAble1 = false;
|
|||
|
|
private bool _gasing1 = false;
|
|||
|
|
// private bool _stopGasAble2=false;
|
|||
|
|
//private bool _gasing2= false;
|
|||
|
|
|
|||
|
|
|
|||
|
|
[Header("搬运输送运行用的模型")]
|
|||
|
|
public GameObject ByssModel1;
|
|||
|
|
[Header("搬运输送运行用的模型")]
|
|||
|
|
public GameObject ByssModel2;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 充气方法
|
|||
|
|
/// </summary>
|
|||
|
|
public void BySS_ChongQi(RaycastHit rayHit)
|
|||
|
|
{
|
|||
|
|
#region 双气泵充气方法
|
|||
|
|
//if (rayHit.transform.name.Equals("QiBengSwitch1"))
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// if (_stopGasAble1 == false && _gasing1 == false)
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// _gasing1 = true;
|
|||
|
|
// _stopGasAble1 = true;
|
|||
|
|
// Debug.Log("充气1");
|
|||
|
|
// _anmCtrl.BYSS_PlayGas1();
|
|||
|
|
// //_anmCtrl.BYSS_PlayGasSound();
|
|||
|
|
// return;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// if ((_stopGasAble1 == true) && (_gasing1 == true) && (_stopGasAble2 == true) && (_gasing2 == true))
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
|
|||
|
|
// IsBYSSChongQiStop_Click1 = true;
|
|||
|
|
|
|||
|
|
// _anmCtrl.BYSS_CloseGas1();
|
|||
|
|
|
|||
|
|
|
|||
|
|
// if (IsBYSSChongQiStop_Click2 && IsBYSSChongQiStop_Click1)
|
|||
|
|
// {
|
|||
|
|
// Debug.Log("最终关闭1");
|
|||
|
|
// _anmCtrl.BYSS_PlayGasSound();
|
|||
|
|
|
|||
|
|
// PopUpMng.PopCustomSucToast("提示", "恭喜您成功完成设备充气", "设备运行", () =>
|
|||
|
|
// {
|
|||
|
|
// if (AppManagement.Instance._CurType == EnumCtrl.Type.XHBY)
|
|||
|
|
// AppManagement.Instance._GasScore += 6;
|
|||
|
|
// else if (AppManagement.Instance._CurType == EnumCtrl.Type.CLFJ ||
|
|||
|
|
// AppManagement.Instance._CurType == EnumCtrl.Type.ZNYD)
|
|||
|
|
// AppManagement.Instance._GasScore += 4;
|
|||
|
|
// AppManagement.Instance.ChangeModel(EnumCtrl.Model.Running);
|
|||
|
|
// });
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
////点击了两个气泵按钮
|
|||
|
|
//if (rayHit.transform.name.Equals("QiBengSwitch2"))
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// if (_stopGasAble2 == false && _gasing2 == false)
|
|||
|
|
// {
|
|||
|
|
// //充气
|
|||
|
|
// // _anmCtrl.GasStart();
|
|||
|
|
// _anmCtrl.BYSS_PlayGas2();
|
|||
|
|
|
|||
|
|
// _gasing2 = true;
|
|||
|
|
// _stopGasAble2 = true;
|
|||
|
|
// return;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if ((_stopGasAble1 == true) && (_gasing1 == true) && (_stopGasAble2 == true) && (_gasing2 == true))
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// IsBYSSChongQiStop_Click2 = true;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// _anmCtrl.BYSS_CloseGas2();
|
|||
|
|
|
|||
|
|
|
|||
|
|
// if (IsBYSSChongQiStop_Click2 && IsBYSSChongQiStop_Click1)
|
|||
|
|
// {
|
|||
|
|
// Debug.Log("最终关闭2");
|
|||
|
|
// _anmCtrl.BYSS_PlayGasSound();
|
|||
|
|
// PopUpMng.PopCustomSucToast("提示", "恭喜您成功完成设备充气", "设备运行", () =>
|
|||
|
|
// {
|
|||
|
|
// if (AppManagement.Instance._CurType == EnumCtrl.Type.XHBY)
|
|||
|
|
// AppManagement.Instance._GasScore += 6;
|
|||
|
|
// else if (AppManagement.Instance._CurType == EnumCtrl.Type.CLFJ ||
|
|||
|
|
// AppManagement.Instance._CurType == EnumCtrl.Type.ZNYD)
|
|||
|
|
// AppManagement.Instance._GasScore += 4;
|
|||
|
|
// AppManagement.Instance.ChangeModel(EnumCtrl.Model.Running);
|
|||
|
|
// });
|
|||
|
|
// }
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
if (rayHit.transform.name.Equals("QiBengSwitch1"))
|
|||
|
|
{
|
|||
|
|
var qibengTransform = rayHit.transform;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (_stopGasAble1 == false && _gasing1 == false)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
_gasing1 = true;
|
|||
|
|
_stopGasAble1 = true;
|
|||
|
|
|
|||
|
|
//上升
|
|||
|
|
qibengTransform.transform.DOLocalMoveY(0.34264f, 0.5f);
|
|||
|
|
|
|||
|
|
GasBtnCanvas.gameObject.SetActive(true);
|
|||
|
|
GasBtnUp.gameObject.SetActive(false);
|
|||
|
|
GasBtnUp.GetComponent<UGUISpriteAnimation>().Stop();
|
|||
|
|
GasBtnDown.gameObject.SetActive(true);
|
|||
|
|
GasBtnDown.GetComponent<UGUISpriteAnimation>().FPS = 30;
|
|||
|
|
GasBtnDown.GetComponent<UGUISpriteAnimation>().Loop = true;
|
|||
|
|
GasBtnDown.GetComponent<UGUISpriteAnimation>().Play();
|
|||
|
|
|
|||
|
|
Debug.Log("充气1");
|
|||
|
|
_anmCtrl.BYSS_PlayGas1();
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if ((_stopGasAble1 == true) && (_gasing1 == true))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
_anmCtrl.BYSS_CloseGas1();
|
|||
|
|
//下降
|
|||
|
|
qibengTransform.transform.DOLocalMoveY(0.34021f, 0.5f);
|
|||
|
|
//指引canvas隐藏
|
|||
|
|
GasBtnCanvas.gameObject.SetActive(false);
|
|||
|
|
GasBtnUp.gameObject.SetActive(false);
|
|||
|
|
GasBtnDown.gameObject.SetActive(false);
|
|||
|
|
GasBtnUp.GetComponent<UGUISpriteAnimation>().Stop();
|
|||
|
|
GasBtnDown.GetComponent<UGUISpriteAnimation>().Stop();
|
|||
|
|
|
|||
|
|
|
|||
|
|
_anmCtrl.BYSS_PlayGasSound();
|
|||
|
|
|
|||
|
|
PopUpMng.PopCustomSucToast("提示", "恭喜您成功完成设备充气", "设备运行", () =>
|
|||
|
|
{
|
|||
|
|
Set_QiBengSwitchs_HighLight_Off();
|
|||
|
|
//指针朝上
|
|||
|
|
_anmCtrl.ZhiZhenXiangShang();
|
|||
|
|
|
|||
|
|
AppManagement.Instance._GasScore += 10;
|
|||
|
|
AppManagement.Instance.ChangeModel(EnumCtrl.Model.Running);
|
|||
|
|
if (speakManager!=null)
|
|||
|
|
{
|
|||
|
|
//修改音乐为设备运行
|
|||
|
|
speakManager.Init();
|
|||
|
|
speakManager.ChangeModelAudio("设备运行");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备运行
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="rayHit"></param>
|
|||
|
|
public void BySS_SheBeiYunXing(RaycastHit rayHit)
|
|||
|
|
{
|
|||
|
|
Debug.Log(rayHit.collider.gameObject.name);
|
|||
|
|
if (rayHit.transform.name.Equals("XuanNiu"))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Debug.Log("XuanNiu!!!!");
|
|||
|
|
PingMu01.gameObject.SetActive(false);
|
|||
|
|
PingMu02.gameObject.SetActive(true);
|
|||
|
|
//旋钮提示隐藏
|
|||
|
|
XuanNiu_RedImage.gameObject.SetActive(false);
|
|||
|
|
|
|||
|
|
//闪烁
|
|||
|
|
v = DOTween.To(() => RedImage.GetComponent<Image>().color, x => RedImage.GetComponent<Image>().color = x,
|
|||
|
|
new Color(255, 0, 0, 0), 0.5f).SetLoops(-1, LoopType.Yoyo);
|
|||
|
|
//启动按钮提示显示
|
|||
|
|
RedImageCanvas.gameObject.SetActive(true);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn"))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//旋钮提示隐藏
|
|||
|
|
XuanNiu_RedImageCanvas.gameObject.SetActive(false);
|
|||
|
|
XuanNiu_RedImage.gameObject.SetActive(false);
|
|||
|
|
//启动按钮提示显示
|
|||
|
|
RedImageCanvas.gameObject.SetActive(false);
|
|||
|
|
//杀死闪烁动画
|
|||
|
|
|
|||
|
|
//播放动画
|
|||
|
|
ByssModel2.GetComponent<AnmCtrl>().RunPlayAnm();
|
|||
|
|
}
|
|||
|
|
if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
Debug.Log("stop");
|
|||
|
|
|
|||
|
|
//播放,停止动画
|
|||
|
|
ByssModel2.GetComponent<AnmCtrl>().RunStopAnm();
|
|||
|
|
|
|||
|
|
PingMu01.gameObject.SetActive(true);
|
|||
|
|
PingMu02.gameObject.SetActive(false);
|
|||
|
|
StopCanvas.gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备运行
|
|||
|
|
/// 设置初始视角
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_BYSS_Running()
|
|||
|
|
{
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.position = BYSS_RunningInitViewCamera.transform.position;
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.rotation = BYSS_RunningInitViewCamera.transform.rotation;
|
|||
|
|
//初始 旋钮提示显示,启动按钮隐藏
|
|||
|
|
XuanNiu_RedImageCanvas.gameObject.SetActive(true);
|
|||
|
|
XuanNiu_RedImage.gameObject.SetActive(true);
|
|||
|
|
RedImageCanvas.gameObject.SetActive(false);
|
|||
|
|
//停止隐藏
|
|||
|
|
StopCanvas.gameObject.SetActive(false);
|
|||
|
|
//提示闪烁
|
|||
|
|
v = DOTween.To(() => XuanNiu_RedImage.GetComponent<Image>().color, x => XuanNiu_RedImage.GetComponent<Image>().color = x,
|
|||
|
|
new Color(255, 0, 0, 0), 0.5f).SetLoops(-1, LoopType.Yoyo);
|
|||
|
|
|
|||
|
|
//隐藏当前模型
|
|||
|
|
//显示10.8号的新模型
|
|||
|
|
ByssModel1.gameObject.SetActive(false);
|
|||
|
|
ByssModel2.gameObject.SetActive(true);
|
|||
|
|
|
|||
|
|
//隐藏充气指引面板
|
|||
|
|
GasBtnCanvas.gameObject.SetActive(false);
|
|||
|
|
GasBtnUp.gameObject.SetActive(false);
|
|||
|
|
GasBtnDown.gameObject.SetActive(false);
|
|||
|
|
GasBtnUp.GetComponent<UGUISpriteAnimation>().Pause();
|
|||
|
|
GasBtnDown.GetComponent<UGUISpriteAnimation>().Pause();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
Tween v;
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 材料分解模块
|
|||
|
|
|
|||
|
|
[Header("下面是材料分解模式要使用的内容")] public GameObject localStartBtn;
|
|||
|
|
public GameObject localStopBtn;
|
|||
|
|
public GameObject localResetBtn;
|
|||
|
|
public GameObject localUrgentStopBtn;
|
|||
|
|
public Vector3 StartBtnlocalPos;
|
|||
|
|
public Vector3 StopBtnlocalPos;
|
|||
|
|
public Vector3 ResetBtnlocalPos;
|
|||
|
|
public Vector3 UrgentStopBtn;
|
|||
|
|
|
|||
|
|
[Header("材料分解模式的落料塔2")] public GameObject CLFJ_LuoLiaoTa2;
|
|||
|
|
[Header("材料分解模式的落料塔3")] public GameObject CLFJ_LuoLiaoTa3;
|
|||
|
|
[Header("急停按钮的动画器")] public Animation CLFJ_UrgentStop_Animation;
|
|||
|
|
|
|||
|
|
[Header("材料分解的设备运行环节初始视角")] public GameObject CLLFJ_RunningInitViewCamera;
|
|||
|
|
// [Header("材料分拣所有的线")] public TerminalCtrl[] ClFJ_All_TerminalCtrl;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 闪烁,所有的端子位置点
|
|||
|
|
/// </summary>
|
|||
|
|
//public void Set_CLFJ_HighLine()
|
|||
|
|
//{
|
|||
|
|
// ClFJ_All_TerminalCtrl = transform.GetComponentsInChildren<TerminalCtrl>();
|
|||
|
|
// for (int i = 0; i < ClFJ_All_TerminalCtrl.Length; i++)
|
|||
|
|
// {
|
|||
|
|
// var v= ClFJ_All_TerminalCtrl[i].gameObject.GetComponent<OutLineRender>().enabled=true;
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// Invoke("Close_CLFJ_HighLine",2f);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 取消显示
|
|||
|
|
/// </summary>
|
|||
|
|
//public void Close_CLFJ_HighLine()
|
|||
|
|
//{
|
|||
|
|
// for (int i = 0; i < ClFJ_All_TerminalCtrl.Length; i++)
|
|||
|
|
// {
|
|||
|
|
// var v= ClFJ_All_TerminalCtrl[i].gameObject.GetComponent<OutLineRender>().enabled=false;
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
public void Set_CLLFJ_RunningInitViewCameran()
|
|||
|
|
{
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.position = CLLFJ_RunningInitViewCamera.transform.position;
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.rotation = CLLFJ_RunningInitViewCamera.transform.rotation;
|
|||
|
|
Camera.main.fieldOfView = 60f; //调整相机FOV
|
|||
|
|
}
|
|||
|
|
//材料分解的急停模式
|
|||
|
|
// private bool Is_CLFJ_UrgentStop = false;
|
|||
|
|
|
|||
|
|
//材料分解的急停按钮,点击次数
|
|||
|
|
public int Click_CLFJ_UrgentStopNum = 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取材料分解四个按钮默认状态
|
|||
|
|
/// </summary>
|
|||
|
|
public void OnGetReSet()
|
|||
|
|
{
|
|||
|
|
_anmState = -1;
|
|||
|
|
//获取参数
|
|||
|
|
|
|||
|
|
StartBtnlocalPos = localStartBtn.gameObject.FindFirst("Red").transform.localPosition;
|
|||
|
|
StopBtnlocalPos = localStopBtn.gameObject.FindFirst("Red").transform.localPosition;
|
|||
|
|
ResetBtnlocalPos = localResetBtn.gameObject.FindFirst("Red").transform.localPosition;
|
|||
|
|
UrgentStopBtn = localUrgentStopBtn.gameObject.FindFirst("Red").transform.localPosition;
|
|||
|
|
|
|||
|
|
CLFJ_UrgentStop_Animation.Rewind();
|
|||
|
|
_anmState = -1;
|
|||
|
|
}
|
|||
|
|
//材料分拣落料塔显示
|
|||
|
|
|
|||
|
|
public void ShowLuoLiaoTa2_3(bool IsShow) {
|
|||
|
|
|
|||
|
|
if (IsShow)
|
|||
|
|
{
|
|||
|
|
CLFJ_LuoLiaoTa2.gameObject.SetActive(true);
|
|||
|
|
CLFJ_LuoLiaoTa3.gameObject.SetActive(true);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CLFJ_LuoLiaoTa2.gameObject.SetActive(false);
|
|||
|
|
CLFJ_LuoLiaoTa3.gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设置材料分解四个按钮默认状态
|
|||
|
|
/// </summary>
|
|||
|
|
public void OnSetReSet()
|
|||
|
|
{
|
|||
|
|
_anmState = -1;
|
|||
|
|
//设置参数
|
|||
|
|
localStartBtn.gameObject.FindFirst("Red").transform.localPosition = StartBtnlocalPos;
|
|||
|
|
localStopBtn.gameObject.FindFirst("Red").transform.localPosition = StopBtnlocalPos;
|
|||
|
|
localResetBtn.gameObject.FindFirst("Red").transform.localPosition = ResetBtnlocalPos;
|
|||
|
|
localUrgentStopBtn.gameObject.FindFirst("Red").transform.localPosition = UrgentStopBtn;
|
|||
|
|
//点击急停按钮次数归零
|
|||
|
|
Click_CLFJ_UrgentStopNum = 0;
|
|||
|
|
CLFJ_UrgentStop_Animation.Rewind();
|
|||
|
|
_anmState = -1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 材料分解,按钮逻辑
|
|||
|
|
/// </summary>
|
|||
|
|
public void ClFJ_ButtonLogic(RaycastHit rayHit)
|
|||
|
|
{
|
|||
|
|
#region 新的逻辑
|
|||
|
|
|
|||
|
|
if (rayHit.transform == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//急停按钮未点击
|
|||
|
|
if (Click_CLFJ_UrgentStopNum == 0)
|
|||
|
|
{
|
|||
|
|
//启动按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn") && _anmState == -1)
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunPlayAnm();
|
|||
|
|
_anmState = 0;
|
|||
|
|
_startBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
Debug.Log("点击到启动按钮");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//停止按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunStopAnm();
|
|||
|
|
_anmState = -1;
|
|||
|
|
_stopBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
Debug.Log("点击到停止按钮");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//复位按钮
|
|||
|
|
if (rayHit.transform.name.Equals("ResetBtn") && _anmState == 1)
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunResetAnm();
|
|||
|
|
_anmState = 0;
|
|||
|
|
_rsetBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
Debug.Log("点击到复位按钮");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//急停按钮
|
|||
|
|
if (rayHit.transform.name.Equals("UrgentStopBtn"))
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunPauseAnm();
|
|||
|
|
_anmState = 1;
|
|||
|
|
_urgentStopBtnTran = rayHit.transform;
|
|||
|
|
|
|||
|
|
CLFJ_UrgentStop_Animation.clip = CLFJ_UrgentStop_Animation.GetClip("UrgentStopBtn_AnYa");
|
|||
|
|
CLFJ_UrgentStop_Animation.Play();
|
|||
|
|
Debug.Log("点击到急停按钮");
|
|||
|
|
|
|||
|
|
//进入急停模式
|
|||
|
|
// Is_CLFJ_UrgentStop = true;
|
|||
|
|
Click_CLFJ_UrgentStopNum = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
|
|||
|
|
//第一次按下急停按钮
|
|||
|
|
if (Click_CLFJ_UrgentStopNum == 1)
|
|||
|
|
{
|
|||
|
|
//启动按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn"))
|
|||
|
|
{
|
|||
|
|
_startBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
//点击失效
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//停止按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
//点击失效
|
|||
|
|
_stopBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//复位按钮
|
|||
|
|
if (rayHit.transform.name.Equals("ResetBtn"))
|
|||
|
|
{
|
|||
|
|
//点击失效
|
|||
|
|
_rsetBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//急停按钮
|
|||
|
|
if (rayHit.transform.name.Equals("UrgentStopBtn"))
|
|||
|
|
{
|
|||
|
|
Debug.Log("第二次按下急停按钮");
|
|||
|
|
|
|||
|
|
_anmCtrl.RunPauseAnm();
|
|||
|
|
_anmState = 1;
|
|||
|
|
_urgentStopBtnTran = rayHit.transform;
|
|||
|
|
CLFJ_UrgentStop_Animation.Play("UrgentStopBtn_TaiQi");
|
|||
|
|
Click_CLFJ_UrgentStopNum = 2;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
|
|||
|
|
//第二次按下急停按钮,急停按钮已经抬起
|
|||
|
|
if (Click_CLFJ_UrgentStopNum == 2)
|
|||
|
|
{
|
|||
|
|
//启动按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn"))
|
|||
|
|
{
|
|||
|
|
//点击失效
|
|||
|
|
_startBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//停止按钮
|
|||
|
|
if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
//点击失效
|
|||
|
|
_stopBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//复位按钮
|
|||
|
|
if (rayHit.transform.name.Equals("ResetBtn"))
|
|||
|
|
{
|
|||
|
|
//急停按钮已经抬起,然后复位按钮生效
|
|||
|
|
Debug.Log("第二次按下急停按钮,复位按钮生效");
|
|||
|
|
_anmCtrl.RunResetAnm();
|
|||
|
|
_anmState = 0;
|
|||
|
|
_rsetBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
Click_CLFJ_UrgentStopNum = 0;
|
|||
|
|
|
|||
|
|
_anmCtrl.RunStopAnm();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//急停按钮
|
|||
|
|
if (rayHit.transform.name.Equals("UrgentStopBtn"))
|
|||
|
|
{
|
|||
|
|
// Debug.Log("第二次按下急停按钮");
|
|||
|
|
//
|
|||
|
|
// _anmCtrl.RunPauseAnm();
|
|||
|
|
// _anmState = 1;
|
|||
|
|
// _urgentStopBtnTran = rayHit.transform;
|
|||
|
|
// CLFJ_UrgentStop_Animation.Play("UrgentStopBtn_TaiQi");
|
|||
|
|
CLFJ_UrgentStop_Animation.clip = CLFJ_UrgentStop_Animation.GetClip("UrgentStopBtn_AnYa");
|
|||
|
|
CLFJ_UrgentStop_Animation.Play();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 气动冲压模块
|
|||
|
|
|
|||
|
|
//自动,手动模式模式判断
|
|||
|
|
private bool Is_QDCY_BtnShouDong = true;
|
|||
|
|
|
|||
|
|
[Header("下面是气动冲压模式要使用的内容")]
|
|||
|
|
//是否停止
|
|||
|
|
public bool IsBtnStop = false;
|
|||
|
|
|
|||
|
|
[Header("动画机_气缸伸缩机_物体")] public GameObject Animator_QiGangShenSuoJi;
|
|||
|
|
[Header("脚本控制_气缸伸缩机_物体")] public GameObject DoTween_QiGangShenSuoJi;
|
|||
|
|
|
|||
|
|
[Header("气动冲压——按钮物体组")]
|
|||
|
|
//气动冲压模式按钮组
|
|||
|
|
public GameObject QDCY_localStartBtn;
|
|||
|
|
|
|||
|
|
public GameObject QDCY_localStopBtn;
|
|||
|
|
|
|||
|
|
//气动冲压模式按钮组位置组
|
|||
|
|
private Vector3 QDCY_StartBtnlocalPos;
|
|||
|
|
private Vector3 QDCY_StopBtnlocalPos;
|
|||
|
|
|
|||
|
|
|
|||
|
|
///得到气动冲压模式的按钮物体
|
|||
|
|
public void Get_QDCYBtn_State()
|
|||
|
|
{
|
|||
|
|
QDCY_StartBtnlocalPos = QDCY_localStartBtn.gameObject.FindFirst("Red").transform.localPosition;
|
|||
|
|
QDCY_StopBtnlocalPos = QDCY_localStopBtn.gameObject.FindFirst("Red").transform.localPosition;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
///设置气动冲压模式的按钮物体
|
|||
|
|
public void Set_QDCYBtn_State()
|
|||
|
|
{
|
|||
|
|
QDCY_localStartBtn.FindFirst("Red").transform.localPosition = QDCY_StartBtnlocalPos;
|
|||
|
|
QDCY_localStopBtn.FindFirst("Red").transform.localPosition = QDCY_StopBtnlocalPos;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//操作按钮,对应的灯光物体
|
|||
|
|
[Header("黄灯指示灯")] public GameObject QDCY_YellowLight;
|
|||
|
|
[Header("绿灯指示灯")] public GameObject QDCY_GreenLight;
|
|||
|
|
|
|||
|
|
//默认材质
|
|||
|
|
[Header("默认指示灯材质")] public Material QDCY_DefaultMaterial;
|
|||
|
|
|
|||
|
|
[Header("发光黄灯材质")]
|
|||
|
|
//开始按钮发光材质球
|
|||
|
|
public Material QDCY_YellowLightMat;
|
|||
|
|
|
|||
|
|
[Header("发光绿灯材质")]
|
|||
|
|
//停止按钮发光材质球
|
|||
|
|
public Material QDCY_GreenLightMat;
|
|||
|
|
|
|||
|
|
private Sequence QiGangShenSuoJiseq;
|
|||
|
|
|
|||
|
|
///设置气缸伸缩机动画
|
|||
|
|
public Sequence SetQiGangShenSuoJi()
|
|||
|
|
{
|
|||
|
|
//先创建一个队列
|
|||
|
|
Sequence sequence = DOTween.Sequence();
|
|||
|
|
_startBtnTran.GetComponent<Collider>().enabled = false;
|
|||
|
|
//在队列里按顺序加入想要播放的动画
|
|||
|
|
sequence.Append(
|
|||
|
|
DoTween_QiGangShenSuoJi.transform.DOLocalMove(new Vector3(0.0059f, 0.0045f, -0.0717f), 0.5f)); //放大图片
|
|||
|
|
sequence.AppendInterval(0);
|
|||
|
|
sequence.Append(
|
|||
|
|
DoTween_QiGangShenSuoJi.transform.DOLocalMove(new Vector3(0.00591021f, 0.004452795f, -0.00981307f),
|
|||
|
|
0.5f));
|
|||
|
|
sequence.AppendInterval(0.5f);
|
|||
|
|
return sequence;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
///<summary>
|
|||
|
|
/// 气动冲压模式
|
|||
|
|
/// 切换自动,手动模式。自动播放机器的自动,手动动画
|
|||
|
|
///在Update里边调用这个方法
|
|||
|
|
/// </summary>>
|
|||
|
|
public void Switch_QDCY_Module()
|
|||
|
|
{
|
|||
|
|
///气动冲压模块
|
|||
|
|
///手动模式
|
|||
|
|
//if (AppManagement.Instance._CurType == EnumCtrl.Type.QDCY &&
|
|||
|
|
// AppManagement.Instance._CurModel == EnumCtrl.Model.Running &&
|
|||
|
|
// Is_QDCY_BtnShouDong && IsBtnStop == false)
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
_anmCtrl.Run_QDCY_ShouDong();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 气动冲压模式模式
|
|||
|
|
/// 按钮逻辑业务
|
|||
|
|
/// 在RunningInteraction的气动冲压模式里,调用这个方法
|
|||
|
|
/// </summary>
|
|||
|
|
public void QDCY_ButtonLogic(RaycastHit rayHit)
|
|||
|
|
{
|
|||
|
|
//手动自动按钮控制动画逻辑
|
|||
|
|
if (rayHit.transform.name.Equals("AutoBtn"))
|
|||
|
|
{
|
|||
|
|
if (!Is_QDCY_BtnShouDong)
|
|||
|
|
{
|
|||
|
|
//模式是手动
|
|||
|
|
Is_QDCY_BtnShouDong = true;
|
|||
|
|
IsBtnStop = false;
|
|||
|
|
_AutoBtnTran.transform.rotation = new Quaternion(0, 0, 0, 0);
|
|||
|
|
// //按钮状态
|
|||
|
|
// Debug.Log("当前是手动");
|
|||
|
|
//重置按钮状态
|
|||
|
|
Set_QDCYBtn_State();
|
|||
|
|
//重置灯状态
|
|||
|
|
//指示灯设置,自动模式绿灯亮,手动模式黄灯亮
|
|||
|
|
QDCY_YellowLight.GetComponent<MeshRenderer>().material = QDCY_YellowLightMat;
|
|||
|
|
QDCY_GreenLight.GetComponent<MeshRenderer>().material = QDCY_DefaultMaterial;
|
|||
|
|
QiGangShenSuoJiseq?.Kill();
|
|||
|
|
Animator_QiGangShenSuoJi.gameObject.SetActive(true);
|
|||
|
|
DoTween_QiGangShenSuoJi.gameObject.SetActive(false);
|
|||
|
|
_anmCtrl.Run_QDCY_ShouDong();
|
|||
|
|
//按钮。碰撞体启用
|
|||
|
|
_startBtnTran.GetComponent<Collider>().enabled = true;
|
|||
|
|
//调用黑幕动画,黑幕重置动画状态
|
|||
|
|
var Running = UI_Manage.Instance.GetPanel("RunningPanel").GetComponent<RunningPanel>();
|
|||
|
|
|
|||
|
|
Running.QDCY_GetBlackMaskToHide();
|
|||
|
|
|
|||
|
|
_anmCtrl.Run_QDCY_ReSet();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//模式是自动
|
|||
|
|
Is_QDCY_BtnShouDong = false;
|
|||
|
|
IsBtnStop = false;
|
|||
|
|
_AutoBtnTran.transform.rotation = new Quaternion(0, 90, 0, 0);
|
|||
|
|
// //按钮状态
|
|||
|
|
// Debug.Log("当前是自动");
|
|||
|
|
//重置按钮状态
|
|||
|
|
Set_QDCYBtn_State();
|
|||
|
|
//重置灯状态
|
|||
|
|
//指示灯设置 ,自动模式绿灯亮,手动模式黄灯亮
|
|||
|
|
QDCY_YellowLight.GetComponent<MeshRenderer>().material = QDCY_DefaultMaterial;
|
|||
|
|
QDCY_GreenLight.GetComponent<MeshRenderer>().material = QDCY_GreenLightMat;
|
|||
|
|
QiGangShenSuoJiseq?.Kill();
|
|||
|
|
Animator_QiGangShenSuoJi.gameObject.SetActive(true);
|
|||
|
|
DoTween_QiGangShenSuoJi.gameObject.SetActive(false);
|
|||
|
|
_anmCtrl.Run_QDCY_ReSet();
|
|||
|
|
//按钮。碰撞体启用
|
|||
|
|
_startBtnTran.GetComponent<Collider>().enabled = true;
|
|||
|
|
//调用黑幕动画,黑幕重置动画状态
|
|||
|
|
var Running = UI_Manage.Instance.GetPanel("RunningPanel").GetComponent<RunningPanel>();
|
|||
|
|
|
|||
|
|
|
|||
|
|
Running.QDCY_GetBlackMaskToHide();
|
|||
|
|
|
|||
|
|
_anmCtrl.Run_QDCY_Auto();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//其他按钮逻辑判断
|
|||
|
|
//手动模式——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
|||
|
|
//开始按钮,并且是手动模式
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn") && Is_QDCY_BtnShouDong)
|
|||
|
|
{
|
|||
|
|
Animator_QiGangShenSuoJi.gameObject.SetActive(false);
|
|||
|
|
DoTween_QiGangShenSuoJi.gameObject.SetActive(true);
|
|||
|
|
|
|||
|
|
_startBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
_startBtnTran.GetComponent<Collider>().enabled = true;
|
|||
|
|
//气缸伸缩机器动画
|
|||
|
|
QiGangShenSuoJiseq = SetQiGangShenSuoJi();
|
|||
|
|
QiGangShenSuoJiseq.Play();
|
|||
|
|
QiGangShenSuoJiseq.OnComplete(() => { _startBtnTran.GetComponent<Collider>().enabled = true; });
|
|||
|
|
} //停止按钮,并且是手动模式
|
|||
|
|
|
|||
|
|
if (rayHit.transform.name.Equals("StopBtn") && Is_QDCY_BtnShouDong)
|
|||
|
|
{
|
|||
|
|
Animator_QiGangShenSuoJi.gameObject.SetActive(false);
|
|||
|
|
DoTween_QiGangShenSuoJi.gameObject.SetActive(true);
|
|||
|
|
|
|||
|
|
_stopBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
QiGangShenSuoJiseq?.Kill();
|
|||
|
|
_startBtnTran.GetComponent<Collider>().enabled = true;
|
|||
|
|
IsBtnStop = true;
|
|||
|
|
//回到停止状态
|
|||
|
|
_anmCtrl.Stop_QDCY_ShouDong();
|
|||
|
|
}
|
|||
|
|
//自动模式——按钮运行无效————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
|||
|
|
//只有启动,停止有效果
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 智能运动控制
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
[Header("智能运动控制模块")] [Header("运行模式相机")]
|
|||
|
|
public GameObject ZNYD_RunningInitViewCamera;
|
|||
|
|
|
|||
|
|
[Header("红色提示")]
|
|||
|
|
public Image ZNYD_RedImage;
|
|||
|
|
|
|||
|
|
[Header("智能运动前后视角")]
|
|||
|
|
public GameObject ZNYD_QianView;
|
|||
|
|
public GameObject ZNYD_Qian1View;
|
|||
|
|
public GameObject ZNYD_HouView;
|
|||
|
|
public GameObject ZNYD_Hou1View;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 智能运动接线,前视角
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_ZNYD_Qian_View() {
|
|||
|
|
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = false;
|
|||
|
|
Camera.main.transform.position = ZNYD_QianView.transform.position;
|
|||
|
|
Camera.main.transform.localEulerAngles = ZNYD_QianView.transform.localEulerAngles;
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public void Set_ZNYD_Qian1_View()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = false;
|
|||
|
|
Camera.main.transform.position = ZNYD_Qian1View.transform.position;
|
|||
|
|
Camera.main.transform.localEulerAngles = ZNYD_Qian1View.transform.localEulerAngles;
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 智能运动接线,后视角
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_ZNYD_Hou_View() {
|
|||
|
|
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = false;
|
|||
|
|
Camera.main.transform.position = ZNYD_HouView.transform.position;
|
|||
|
|
Camera.main.transform.localEulerAngles = ZNYD_HouView.transform.localEulerAngles;
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public void Set_ZNYD_Hou1_View()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = false;
|
|||
|
|
Camera.main.transform.position = ZNYD_Hou1View.transform.position;
|
|||
|
|
Camera.main.transform.localEulerAngles = ZNYD_Hou1View.transform.localEulerAngles;
|
|||
|
|
Camera.main.GetComponent<CameraControl>().enabled = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SetZhiNengYunDong() {
|
|||
|
|
|
|||
|
|
|
|||
|
|
ZNYD_RedImage.gameObject.SetActive(true);
|
|||
|
|
|
|||
|
|
DOTween.To(() => ZNYD_RedImage.GetComponent<Image>().color, x => ZNYD_RedImage.GetComponent<Image>().color = x,
|
|||
|
|
new Color(255, 0, 0, 0), 0.5f).SetLoops(-1, LoopType.Yoyo);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 智能运动模式,设备运行按钮逻辑
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="rayHit"></param>
|
|||
|
|
public void ZNYD_ButtonLogic(RaycastHit rayHit) {
|
|||
|
|
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn") && _anmState == -1)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
ZNYD_RedImage.gameObject.SetActive(false);
|
|||
|
|
|
|||
|
|
|
|||
|
|
_anmCtrl.RunPlayAnm();
|
|||
|
|
_anmState = 0;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunStopAnm();
|
|||
|
|
_anmState = -1;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (rayHit.transform.name.Equals("ResetBtn") && _anmState == 1)
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunResetAnm();
|
|||
|
|
_anmState = 0;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (rayHit.transform.name.Equals("UrgentStopBtn"))
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunPauseAnm();
|
|||
|
|
_anmState = 1;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设置
|
|||
|
|
/// 设备运行环节初始视角调整
|
|||
|
|
/// </summary>
|
|||
|
|
public void Set_ZNYD_Running()
|
|||
|
|
{
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.position = ZNYD_RunningInitViewCamera.transform.position;
|
|||
|
|
Camera.main.GetComponent<Transform>().transform.rotation = ZNYD_RunningInitViewCamera.transform.rotation;
|
|||
|
|
Camera.main.fieldOfView = 60f; //调整相机FOV
|
|||
|
|
|
|||
|
|
SetZhiNengYunDong();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 运行
|
|||
|
|
|
|||
|
|
//private void PlayAnm()
|
|||
|
|
//{
|
|||
|
|
// _anmCtrl.RunPlayAnm();
|
|||
|
|
// _anmState = 0;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
private void RunningInteraction(RaycastHit rayHit)
|
|||
|
|
{
|
|||
|
|
//设置气动冲压模式操作按钮 特殊的动画设置
|
|||
|
|
if (AppManagement.Instance._CurType == UTility.EnumCtrl.Type.QDCY)
|
|||
|
|
{
|
|||
|
|
QDCY_ButtonLogic(rayHit);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//材料分解模式的按钮逻辑
|
|||
|
|
else if (AppManagement.Instance._CurType == UTility.EnumCtrl.Type.CLFJ)
|
|||
|
|
{
|
|||
|
|
ClFJ_ButtonLogic(rayHit);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//搬运输送特殊模式设置
|
|||
|
|
else if (AppManagement.Instance._CurType == UTility.EnumCtrl.Type.BYSS)
|
|||
|
|
{
|
|||
|
|
BySS_SheBeiYunXing(rayHit);
|
|||
|
|
}//智能运动模式设置
|
|||
|
|
else if (AppManagement.Instance._CurType == UTility.EnumCtrl.Type.ZNYD)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
ZNYD_ButtonLogic(rayHit);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}//循环搬运机械手
|
|||
|
|
|
|||
|
|
else if (AppManagement.Instance._CurType == UTility.EnumCtrl.Type.XHBY)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
XHBY_SheBeiYunXing(rayHit);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//其他模式的动画播放
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (rayHit.transform.name.Equals("StartBtn") && _anmState == -1)
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunPlayAnm();
|
|||
|
|
_anmState = 0;
|
|||
|
|
_startBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
else if (rayHit.transform.name.Equals("StopBtn"))
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunStopAnm();
|
|||
|
|
_anmState = -1;
|
|||
|
|
_stopBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
else if (rayHit.transform.name.Equals("ResetBtn") && _anmState == 1)
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunResetAnm();
|
|||
|
|
_anmState = 0;
|
|||
|
|
_rsetBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
else if (rayHit.transform.name.Equals("UrgentStopBtn"))
|
|||
|
|
{
|
|||
|
|
_anmCtrl.RunPauseAnm();
|
|||
|
|
_anmState = 1;
|
|||
|
|
_urgentStopBtnTran = rayHit.transform;
|
|||
|
|
ChangeBtnState(rayHit.transform);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void ChangeBtnState(Transform ClickBtnTran)
|
|||
|
|
{
|
|||
|
|
Transform[] btnTrans = new Transform[4];
|
|||
|
|
btnTrans[0] = _startBtnTran;
|
|||
|
|
btnTrans[1] = _stopBtnTran;
|
|||
|
|
btnTrans[2] = _rsetBtnTran;
|
|||
|
|
btnTrans[3] = _urgentStopBtnTran;
|
|||
|
|
|
|||
|
|
//for (int i = 0; i < btnTrans.Length; i++)
|
|||
|
|
//{
|
|||
|
|
// if (btnTrans[i])
|
|||
|
|
// {
|
|||
|
|
// if (btnTrans[i] == ClickBtnTran)
|
|||
|
|
// {
|
|||
|
|
// //按下
|
|||
|
|
// btnTrans[i].Find("Red").DOLocalMoveZ(0, 0.1f).SetEase(Ease.OutExpo).SetLoops(2, LoopType.Yoyo);
|
|||
|
|
// }
|
|||
|
|
// // else
|
|||
|
|
// // {
|
|||
|
|
// // //抬起
|
|||
|
|
// // btnTrans[i].Find("Red").DOLocalMoveZ(0.005f, 0.1f);
|
|||
|
|
// // }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
float z = ClickBtnTran.Find("Red").transform.localPosition.z;
|
|||
|
|
var v = ClickBtnTran.Find("Red").gameObject;
|
|||
|
|
|
|||
|
|
Tween t=AnNiu(v,z);
|
|||
|
|
t.Play().OnComplete(()=> {
|
|||
|
|
|
|||
|
|
// t.Kill();
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public Sequence AnNiu(GameObject gameObject,float f) {
|
|||
|
|
|
|||
|
|
Sequence sequence = DOTween.Sequence();
|
|||
|
|
var v = gameObject.transform.DOLocalMoveZ(-0.005f, 0.2f);
|
|||
|
|
sequence.Insert(0, v);
|
|||
|
|
v = gameObject.transform.DOLocalMoveZ(f, 0.2f);
|
|||
|
|
sequence.Insert(0.2f, v);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
return sequence;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
}
|