467 lines
26 KiB
C#
467 lines
26 KiB
C#
using CG.Framework;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using ZXK.GYJQR;
|
|
/// <summary>
|
|
/// 用来保存场景中所有模型类的管理类
|
|
/// </summary>
|
|
namespace ZXK.GYJQR
|
|
{
|
|
public class ModelManager : Singleton<ModelManager>
|
|
{
|
|
[HideInInspector]
|
|
public List<ModelData> modelDatas = new List<ModelData>();//用来保存所有物件数据类的列表
|
|
public List<GameObject> azbsParts;//安装部署高亮组件
|
|
|
|
// Add By CG 加入关于示教器状态变化和示教器位置控制相关脚本
|
|
public bool _SJQMoveAble { get; set; } = true;
|
|
public GameObject _sjqModle = null;
|
|
private ShiJiaoQiTuLiCtrlPanel _sjqPanelCtrl = null;
|
|
private Ray _ray;
|
|
private RaycastHit[] _rayHits;
|
|
private Vector3 _mouseDownPosScreen = Vector3.one * -1;
|
|
public Vector3 _distancePos;
|
|
[ReadOnly]
|
|
public float[] _sjqCanvasValues = new float[6];
|
|
public float[] _zhouInitRotValues = new float[6] { -20.0f, 10.0f, 60.0f, 8.0f, 90.0f, 45.0f };
|
|
|
|
private void Start()
|
|
{
|
|
for (int i = 0; i < azbsParts.Count; i++)
|
|
{
|
|
ModelData dataitem = new ModelData(azbsParts[i], azbsParts[i].transform.rotation, azbsParts[i].transform.position, azbsParts[i].tag);
|
|
AddModelData(dataitem);
|
|
}
|
|
InitAllGeo();
|
|
}
|
|
|
|
private void Update()
|
|
{//示教器位置控制相关脚本
|
|
if (StepManager.Instance.CurAZBSState.Equals("轴向校零") && _sjqModle && _SJQMoveAble)
|
|
{
|
|
if (!CG.UTility.PopUpMng._TriAble) return;
|
|
if (Input.GetMouseButtonDown(0))
|
|
{
|
|
_ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
_rayHits = Physics.RaycastAll(_ray);
|
|
if (_rayHits != null && _rayHits.Length > 0)
|
|
{
|
|
for (int i = 0; i < _rayHits.Length; i++)
|
|
{
|
|
if (_rayHits[i].transform == _sjqModle.transform)
|
|
{
|
|
_mouseDownPosScreen = Input.mousePosition;
|
|
_mouseDownPosScreen.z = _sjqModle.transform.localPosition.z;
|
|
Vector3 mouseWorld = Camera.main.ScreenToWorldPoint(_mouseDownPosScreen);
|
|
_distancePos = _sjqModle.transform.position - mouseWorld;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Input.GetMouseButton(0) && _mouseDownPosScreen.x > 0)
|
|
{
|
|
Vector3 mouseScreen = Input.mousePosition;
|
|
mouseScreen.z = _sjqModle.transform.localPosition.z;
|
|
Vector3 mouseWorld = Camera.main.ScreenToWorldPoint(mouseScreen);
|
|
_sjqModle.transform.position = (mouseWorld + _distancePos);
|
|
}
|
|
}
|
|
if (Input.GetMouseButtonUp(0))
|
|
{
|
|
_mouseDownPosScreen = Vector2.one * -1;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 添加物件数据类到列表中
|
|
/// </summary>
|
|
public void AddModelData(ModelData data)
|
|
{
|
|
if (modelDatas == null)
|
|
{
|
|
WDebug.LogError("当前列表" + modelDatas + "不存在");
|
|
return;
|
|
}
|
|
if (modelDatas.Contains(data))
|
|
{
|
|
WDebug.LogError("当前列表" + modelDatas + "已经包含" + data + "的元素");
|
|
return;
|
|
}
|
|
modelDatas.Add(data);
|
|
}
|
|
/// <summary>
|
|
/// 根据名称查找到对应的物件
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public GameObject SeekPathModeWithName(string _modelName)
|
|
{
|
|
return modelDatas.Find(a => a.modelPart.name == _modelName).modelPart;
|
|
}
|
|
/// <summary>
|
|
/// 根据名称查找到对应的物件
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public GameObject SeekAZBSPart(string _modelName)
|
|
{
|
|
foreach (var item in azbsParts)
|
|
{
|
|
if (item.name == _modelName)
|
|
{
|
|
return item;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
/// <summary>
|
|
/// 执行终止函数
|
|
/// </summary>
|
|
public void OnEndCallBack()
|
|
{
|
|
foreach (var item in modelDatas)
|
|
{
|
|
if (item.modePm == null)
|
|
{
|
|
return;
|
|
}
|
|
item.modePm.OnEnd();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据进入场景时物体信息初始化场景内物体
|
|
/// </summary>
|
|
public void InitAllGeo()
|
|
{
|
|
for (int i = 0; i < modelDatas.Count; i++)
|
|
{
|
|
if (modelDatas[i].modelTag.Equals(CG.UTility.ConstCtrl.Const_SceneONLY))
|
|
{
|
|
modelDatas[i].modelPart.SetActive(modelDatas[i].modelShowAble);
|
|
modelDatas[i].modelPart.transform.rotation = modelDatas[i].startWorldEuler;
|
|
modelDatas[i].modelPart.transform.position = modelDatas[i].startWorldPosition;
|
|
}
|
|
}
|
|
|
|
InitLJQDDLState(false);
|
|
InitLJXHDLState(false);
|
|
InitSJQDLState(false);
|
|
InitLJDYXState(false);
|
|
InitSBKJState(false);
|
|
|
|
}
|
|
/// <summary>
|
|
/// 初始化为完成状态
|
|
/// </summary>
|
|
/// <param name="enter"></param>
|
|
public void InitLJQDDLState(bool finish)
|
|
{
|
|
if (finish)
|
|
{
|
|
SeekAZBSPart("SM_shebesuliao473").SetActive(false);
|
|
SeekAZBSPart("SM_shebesuliao473").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_kzg_qudongdianlanjietou").GetComponent<Collider>().isTrigger = true;
|
|
SeekAZBSPart("SM_kzg_qudongdianlanjietou").GetComponent<Rigidbody>().useGravity = false;
|
|
SeekAZBSPart("SM_kzg_qudongdianlanjietou").GetComponent<Rigidbody>().isKinematic = true;
|
|
SetTRAble(SeekAZBSPart("SM_kzg_qudongdianlanjietou"), new Vector3(0.2311219f, -0.407734f, -0.3555889f), new Vector3(46, 0, -199), true);
|
|
SetRot(SeekAZBSPart("SM_guanxian108"), new Vector3(72.221f, 0, 0));
|
|
SetRot(SeekAZBSPart("SM_guanxian109"), new Vector3(-12.792f, 0, 0));
|
|
|
|
SeekAZBSPart("SM_shebesuliao474").SetActive(false);
|
|
SeekAZBSPart("SM_shebesuliao474").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_jxzt_qudongdianlanjietou").GetComponent<Collider>().isTrigger = true;
|
|
SeekAZBSPart("SM_jxzt_qudongdianlanjietou").GetComponent<Rigidbody>().useGravity = false;
|
|
SeekAZBSPart("SM_jxzt_qudongdianlanjietou").GetComponent<Rigidbody>().isKinematic = true;
|
|
SetTRAble(SeekAZBSPart("SM_jxzt_qudongdianlanjietou"), new Vector3(1.259484f, -0.07679999f, -0.724453f), new Vector3(0, 90, 0), true);
|
|
SetRot(SeekAZBSPart("SM_jixiezhuti153"), new Vector3(-20.704f, 0, 0));
|
|
SetRot(SeekAZBSPart("SM_jixiezhuti261"), new Vector3(20.704f, 0, 0));
|
|
}
|
|
else
|
|
{
|
|
SeekAZBSPart("SM_shebesuliao473").SetActive(true);
|
|
SeekAZBSPart("SM_shebesuliao473").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_kzg_qudongdianlanjietou").GetComponent<Collider>().enabled = true;
|
|
SeekAZBSPart("SM_kzg_qudongdianlanjietou").GetComponent<Collider>().isTrigger = false;
|
|
SeekAZBSPart("SM_kzg_qudongdianlanjietou").GetComponent<Rigidbody>().useGravity = true;
|
|
SeekAZBSPart("SM_kzg_qudongdianlanjietou").GetComponent<Rigidbody>().isKinematic = false;
|
|
SetTRAble(SeekAZBSPart("SM_kzg_qudongdianlanjietou"), new Vector3(0.0516f, -0.4988f, -0.216f), new Vector3(0, 0, -93.551f), true);
|
|
SetRot(SeekAZBSPart("SM_guanxian108"), new Vector3(14.987f, 0, 0));
|
|
SetRot(SeekAZBSPart("SM_guanxian109"), new Vector3(54.452f, 0, 0));
|
|
|
|
SeekAZBSPart("SM_shebesuliao474").SetActive(true);
|
|
SeekAZBSPart("SM_shebesuliao474").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_jxzt_qudongdianlanjietou").GetComponent<Collider>().enabled = true;
|
|
SeekAZBSPart("SM_jxzt_qudongdianlanjietou").GetComponent<Collider>().isTrigger = false;
|
|
SeekAZBSPart("SM_jxzt_qudongdianlanjietou").GetComponent<Rigidbody>().useGravity = true;
|
|
SeekAZBSPart("SM_jxzt_qudongdianlanjietou").GetComponent<Rigidbody>().isKinematic = false;
|
|
SetTRAble(SeekAZBSPart("SM_jxzt_qudongdianlanjietou"), new Vector3(1.2612f, -0.485f, -0.725f), new Vector3(-0.484f, 140.457f, 90.4f), true);
|
|
SetRot(SeekAZBSPart("SM_jixiezhuti153"), new Vector3(0, 0, 0));
|
|
SetRot(SeekAZBSPart("SM_jixiezhuti261"), new Vector3(0, 0, 0));
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始化为完成状态
|
|
/// </summary>
|
|
/// <param name="enter"></param>
|
|
public void InitLJXHDLState(bool finish)
|
|
{
|
|
if (finish)
|
|
{
|
|
SeekAZBSPart("SM_shebesuliao35").SetActive(false);
|
|
SeekAZBSPart("SM_shebesuliao35").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_kzg_xinhaodianlanjietou").GetComponent<Collider>().isTrigger = true;
|
|
SeekAZBSPart("SM_kzg_xinhaodianlanjietou").GetComponent<Rigidbody>().useGravity = false;
|
|
SeekAZBSPart("SM_kzg_xinhaodianlanjietou").GetComponent<Rigidbody>().isKinematic = true;
|
|
SetTRAble(SeekAZBSPart("SM_kzg_xinhaodianlanjietou"), new Vector3(-0.2930847f, -0.4017974f, -0.3740788f), new Vector3(136.006f, 0, 0), true);
|
|
SetTRAble(SeekAZBSPart("polySurface74"), new Vector3(0, -0.0221f, 0), new Vector3(0, 150.0f, 0), true);
|
|
|
|
SeekAZBSPart("SM_shebesuliao92").SetActive(false);
|
|
SeekAZBSPart("SM_shebesuliao92").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_jxzt_xinhaodianlanjietou").GetComponent<Collider>().isTrigger = true;
|
|
SeekAZBSPart("SM_jxzt_xinhaodianlanjietou").GetComponent<Rigidbody>().useGravity = false;
|
|
SeekAZBSPart("SM_jxzt_xinhaodianlanjietou").GetComponent<Rigidbody>().isKinematic = true;
|
|
SetTRAble(SeekAZBSPart("SM_jxzt_xinhaodianlanjietou"), new Vector3(1.285572f, -0.03403676f, -0.6600628f), new Vector3(0, 90.0f, 0), true);
|
|
SetTRAble(SeekAZBSPart("polySurface58"), new Vector3(0, 0, 0.0204f), new Vector3(0, 0, 150), true);
|
|
}
|
|
else
|
|
{
|
|
|
|
SeekAZBSPart("SM_shebesuliao35").SetActive(true);
|
|
SeekAZBSPart("SM_shebesuliao35").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_kzg_xinhaodianlanjietou").GetComponent<Collider>().enabled = true;
|
|
SeekAZBSPart("SM_kzg_xinhaodianlanjietou").GetComponent<Collider>().isTrigger = false;
|
|
SeekAZBSPart("SM_kzg_xinhaodianlanjietou").GetComponent<Rigidbody>().useGravity = true;
|
|
SeekAZBSPart("SM_kzg_xinhaodianlanjietou").GetComponent<Rigidbody>().isKinematic = false;
|
|
SetTRAble(SeekAZBSPart("SM_kzg_xinhaodianlanjietou"), new Vector3(-0.363f, -0.5423f, -0.3307f), new Vector3(94.47501f, 0, 0), true);
|
|
SetTRAble(SeekAZBSPart("polySurface74"), new Vector3(0, -0.0077f, 0), new Vector3(-180.0f, 92.361f, 0), true);
|
|
|
|
SeekAZBSPart("SM_shebesuliao92").SetActive(true);
|
|
SeekAZBSPart("SM_shebesuliao92").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_jxzt_xinhaodianlanjietou").GetComponent<Collider>().enabled = true;
|
|
SeekAZBSPart("SM_jxzt_xinhaodianlanjietou").GetComponent<Collider>().isTrigger = false;
|
|
SeekAZBSPart("SM_jxzt_xinhaodianlanjietou").GetComponent<Rigidbody>().useGravity = true;
|
|
SeekAZBSPart("SM_jxzt_xinhaodianlanjietou").GetComponent<Rigidbody>().isKinematic = false;
|
|
SetTRAble(SeekAZBSPart("SM_jxzt_xinhaodianlanjietou"), new Vector3(1.349f, -0.526f, -0.424f), new Vector3(0, 55.067f, 0), true);
|
|
SetTRAble(SeekAZBSPart("polySurface58"), new Vector3(0, 0, 0.0075f), new Vector3(0, 0, 0), true);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始化为完成状态
|
|
/// </summary>
|
|
/// <param name="enter"></param>
|
|
public void InitSJQDLState(bool finish)
|
|
{
|
|
if (finish)
|
|
{
|
|
SeekAZBSPart("SM_shebesuliao32").SetActive(false);
|
|
SeekAZBSPart("SM_shebesuliao32").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_shijiaoqijietou").GetComponent<Collider>().isTrigger = true;
|
|
SeekAZBSPart("SM_shijiaoqijietou").GetComponent<Rigidbody>().useGravity = false;
|
|
SeekAZBSPart("SM_shijiaoqijietou").GetComponent<Rigidbody>().isKinematic = true;
|
|
SetTRAble(SeekAZBSPart("SM_shijiaoqijietou"), new Vector3(0.3551406f, -0.5776956f, 0.1999912f), new Vector3(0, 0, 0), true);
|
|
SetTRAble(SeekAZBSPart("polySurface98"), new Vector3(0, 0, -0.0196f), new Vector3(0, 0, 150.0f), true);
|
|
}
|
|
else
|
|
{
|
|
SeekAZBSPart("SM_shebesuliao32").SetActive(true);
|
|
SeekAZBSPart("SM_shebesuliao32").GetComponent<Rigidbody>().isKinematic = true;
|
|
SeekAZBSPart("SM_shijiaoqijietou").GetComponent<Collider>().enabled = true;
|
|
SeekAZBSPart("SM_shijiaoqijietou").GetComponent<Collider>().isTrigger = false;
|
|
SeekAZBSPart("SM_shijiaoqijietou").GetComponent<Rigidbody>().useGravity = false;
|
|
SeekAZBSPart("SM_shijiaoqijietou").GetComponent<Rigidbody>().isKinematic = true;
|
|
SetTRAble(SeekAZBSPart("SM_shijiaoqijietou"), new Vector3(0.272f, -0.6363f, 0.2057f), new Vector3(-87.088f, 0, 0), true);
|
|
SetTRAble(SeekAZBSPart("polySurface98"), new Vector3(0, 0, -0.01843f), new Vector3(0, 0, 0), true);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始化为完成状态
|
|
/// </summary>
|
|
/// <param name="enter"></param>
|
|
public void InitLJDYXState(bool finish)
|
|
{
|
|
if (finish)
|
|
{
|
|
SeekAZBSPart("qidongqi").transform.parent.GetComponent<Animator>().enabled = false;
|
|
SetTRAble(SeekAZBSPart("SM_waikejinshu34"), new Vector3(0.5435513f, 0.181288f, 0.03245407f), new Vector3(-24.542f, 0, -49.391f), true);
|
|
GameObject door = SeekAZBSPart("SM_waikejinshu32");
|
|
SetRot(door, new Vector3(0, -90.0f, 0));
|
|
SetTRAble(door.transform.parent.transform.Find("SM_guanxian98 (1)/Point (2)").gameObject, new Vector3(1.3668f, -0.2224f, -0.1131f), new Vector3(-49.525f, -60.666f, -201.368f), true);
|
|
SetTRAble(door.transform.parent.transform.Find("SM_guanxian98 (1)/Point (3)").gameObject, new Vector3(1.4209f, -0.1999f, -0.1649f), new Vector3(0, -95.16f, -145.176f), true);
|
|
SetTRAble(door.transform.parent.transform.Find("SM_guanxian98 (1)/OneEndPoint").gameObject, new Vector3(1.3257f, 0.1991f, -0.1829f), new Vector3(8.115f, -77.468f, -180.774f), true);
|
|
|
|
SetTRAble(SeekAZBSPart("qidongqi").gameObject, new Vector3(0.0859f, 0.4309f, -1.1081f), new Vector3(0, 0, 0), true);
|
|
|
|
Transform twoLineTran = door.transform.parent.transform.Find("SM_guanxian98 (1)/TwoLine");
|
|
SetTRAble(twoLineTran.gameObject, new Vector3(1.4915f, -0.277f, -0.341f), new Vector3(-0.264f, -122.732f, -89.51f), true);
|
|
twoLineTran.GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = false;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointBox").gameObject, new Vector3(-0.7284604f, 0.2387998f, 0.0285517f), new Vector3(1.804f, -97.955f, -144.589f), true);
|
|
twoLineTran.Find("TwoEndPointBox").GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = true;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointBox (1)").gameObject, new Vector3(-0.7560668f, 0.2378961f, 0.02807042f), new Vector3(-47.993f, -8.323f, -178.211f), true);
|
|
twoLineTran.Find("TwoEndPointBox (1)").GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = true;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointBox (2)").gameObject, new Vector3(-0.7424564f, 0.2388485f, 0.02896011f), new Vector3(-0.779f, 81.633f, 143.983f), true);
|
|
twoLineTran.Find("TwoEndPointBox (2)").GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = true;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointYellow").gameObject, new Vector3(-0.0088f, 0.0582f, 0.0331f), new Vector3(71.953f, -326.439f, -151.288f), true);
|
|
|
|
SetTRAble(SeekAZBSPart("SM_guanxian110").gameObject, new Vector3(2.7102f, -0.3886f, 0.3103f), new Vector3(155.27f, -93.148f, 33.947f), true);
|
|
SeekAZBSPart("SM_xian1").gameObject.SetActive(false);
|
|
SeekAZBSPart("SM_shou").SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
SeekAZBSPart("qidongqi").transform.parent.GetComponent<Animator>().enabled = false;
|
|
SetTRAble(SeekAZBSPart("SM_waikejinshu34"), new Vector3(0.5435513f, 0.181288f, 0.03245407f), new Vector3(0, 0, 0), true);
|
|
GameObject door = SeekAZBSPart("SM_waikejinshu32");
|
|
SetRot(door, new Vector3(0, 0, 0));
|
|
SetTRAble(door.transform.parent.transform.Find("SM_guanxian98 (1)/Point (2)").gameObject, new Vector3(1.223f, -0.42f, 0.036f), new Vector3(0, -62.886f, -90.0f), true);
|
|
SetTRAble(door.transform.parent.transform.Find("SM_guanxian98 (1)/Point (3)").gameObject, new Vector3(1.0743f, -0.42f, -0.0769f), new Vector3(0, -120.236f, -90.0f), true);
|
|
SetTRAble(door.transform.parent.transform.Find("SM_guanxian98 (1)/OneEndPoint").gameObject, new Vector3(1.3257f, 0.1991f, -0.1829f), new Vector3(8.115f, -77.468f, -180.774f), true);
|
|
SetTRAble(SeekAZBSPart("qidongqi").gameObject, new Vector3(0.0859f, 0.4309f, -1.1081f), new Vector3(0, 0, 0), true);
|
|
Transform twoLineTran = door.transform.parent.transform.Find("SM_guanxian98 (1)/TwoLine");
|
|
SetTRAble(twoLineTran.gameObject, new Vector3(1.2685f, -0.42f, -0.1768f), new Vector3(0, -85.0f, -90.0f), true);
|
|
twoLineTran.GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = false;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointBox").gameObject, new Vector3(0.006800026f, -0.06619196f, -0.00963695f), new Vector3(14.276f, 0, 0), true);
|
|
twoLineTran.Find("TwoEndPointBox").GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = false;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointBox (1)").gameObject, new Vector3(0, -0.06830263f, -0.002955016f), new Vector3(14.276f, 0, 0), true);
|
|
twoLineTran.Find("TwoEndPointBox (1)").GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = false;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointBox (2)").gameObject, new Vector3(-0.004550011f, -0.06586536f, -0.009467654f), new Vector3(14.276f, 0, 0), true);
|
|
twoLineTran.Find("TwoEndPointBox (2)").GetComponent<UnityEngine.Animations.ParentConstraint>().enabled = false;
|
|
SetTRAble(twoLineTran.Find("TwoEndPointYellow").gameObject, new Vector3(-0.0046f, -0.0647717f, -0.01474096f), new Vector3(-0.685f, -165.807f, -140.389f), true);
|
|
SetTRAble(SeekAZBSPart("SM_guanxian110"), new Vector3(2.6358f, -0.4075f, 0.2731f), new Vector3(181.465f, -109.739f, 30.489f), true);
|
|
SeekAZBSPart("SM_xian1").gameObject.SetActive(true);
|
|
SeekAZBSPart("SM_shou").SetActive(false);
|
|
SeekAZBSPart("qidongqi").transform.parent.GetComponent<Animator>().SetInteger("StepIndex", 0);
|
|
SeekAZBSPart("qidongqi").transform.parent.GetComponent<Animator>().enabled = true;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始化为完成状态
|
|
/// </summary>
|
|
/// <param name="enter"></param>
|
|
public void InitSBKJState(bool finish)
|
|
{
|
|
if (finish)
|
|
{
|
|
SeekAZBSPart("WanYongBiao").transform.parent.GetComponent<Animator>().enabled = false;
|
|
SeekAZBSPart("WanYongBiao").SetActive(false);
|
|
SetTRAble(SeekAZBSPart("SM_waikejinshu34"), new Vector3(0.5435513f, 0.181288f, 0.03245407f), new Vector3(0, 0, 0), true);
|
|
GameObject door = SeekAZBSPart("SM_waikejinshu32");
|
|
SeekAZBSPart("SM_shebesuliao25").GetComponent<MeshRenderer>().material.SetColor("_BaseColor", Color.red);
|
|
SetRot(door, new Vector3(0, 0, 0));
|
|
SetRot(SeekAZBSPart("SM_shebesuliao583"), new Vector3(0, 0, 90));
|
|
}
|
|
else
|
|
{
|
|
SeekAZBSPart("WanYongBiao").transform.parent.GetComponent<Animator>().enabled = false;
|
|
SeekAZBSPart("WanYongBiao").SetActive(true);
|
|
//SetTRAble(SeekAZBSPart("SM_waikejinshu34"), new Vector3(0.5435513f, 0.181288f, 0.03245407f), new Vector3(0, 0, 0), true);
|
|
//GameObject door = SeekAZBSPart("SM_waikejinshu32");
|
|
//SetRot(door, new Vector3(0, 0, 0));
|
|
SeekAZBSPart("SM_shebesuliao25").GetComponent<MeshRenderer>().material.SetColor("_BaseColor", Color.white);
|
|
SetRot(SeekAZBSPart("SM_shebesuliao583"), new Vector3(0, 0, 0));
|
|
SeekAZBSPart("WanYongBiao").transform.parent.GetComponent<Animator>().SetInteger("StepIndex", 0);
|
|
SeekAZBSPart("WanYongBiao").transform.parent.GetComponent<Animator>().enabled = true;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始化轴向校零时示教器的状态
|
|
/// </summary>
|
|
/// <param name="enter">进入状态或者退出状态</param>
|
|
public void InitZXXLSJQState(bool enter)
|
|
{
|
|
Transform jXZT_zhou1 = ModelManager.Instance.SeekAZBSPart(CG.UTility.ConstCtrl.Const_JXZT_zhou1).transform;
|
|
Transform jXZT_zhou2 = jXZT_zhou1.Find("joint2/join3Parent/joint3");
|
|
Transform jXZT_zhou3 = jXZT_zhou2.Find("join4Parent/joint4");
|
|
Transform jXZT_zhou4 = jXZT_zhou3.Find("join5Parent/joint5");
|
|
Transform jXZT_zhou5 = jXZT_zhou4.Find("joint6");
|
|
Transform jXZT_zhou6 = jXZT_zhou5.Find("joint7");
|
|
if (_sjqModle == null)
|
|
{
|
|
_sjqModle = SeekAZBSPart(CG.UTility.ConstCtrl.Const_SJQ);
|
|
}
|
|
|
|
jXZT_zhou1.localRotation = Quaternion.Euler(new Vector3(0.0f, -20.0f, -90.0f));
|
|
jXZT_zhou2.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 10.0f));
|
|
jXZT_zhou3.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 60.0f));
|
|
jXZT_zhou4.localRotation = Quaternion.Euler(new Vector3(8.0f, 0.0f, 0.0f));
|
|
jXZT_zhou5.localRotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 90.0f));
|
|
jXZT_zhou6.localRotation = Quaternion.Euler(new Vector3(45.0f, 0.0f, 0.0f));
|
|
|
|
_sjqModle.transform.Find("SM_shijiaoqijiexian/SM_guanxian44").gameObject.SetActive(!enter);
|
|
_sjqModle.transform.Find("SM_shijiaoqijiexian/SM_shijiaoqijietou").gameObject.SetActive(!enter);
|
|
_sjqModle.transform.Find("Canvas").gameObject.SetActive(enter);
|
|
Transform sjqPanel = _sjqModle.transform.Find("Canvas/Panels");
|
|
foreach (Transform item in sjqPanel)
|
|
{
|
|
if (item.name.Equals("A01"))
|
|
{
|
|
item.gameObject.SetActive(true);
|
|
item.Find("ManualBtn/BorderImg").gameObject.SetActive(true);
|
|
item.Find("MenuNoSel/BorderImg").gameObject.SetActive(false);
|
|
item.Find("JiaozhunBtn/BorderImg").gameObject.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
item.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
if (enter)
|
|
{
|
|
_sjqPanelCtrl = UI_Manage.Instance.ShowPanel("ShiJiaoQiTuLiCtrlPanel", System.Type.GetType("ZXK.GYJQR.ShiJiaoQiTuLiCtrlPanel"), UIGroup.Main).GetComponent<ShiJiaoQiTuLiCtrlPanel>();
|
|
_sjqPanelCtrl.sjq = _sjqModle;
|
|
_sjqModle.transform.SetParent(Camera.main.transform);
|
|
_sjqModle.transform.localPosition = new Vector3(-0.042f, -0.011f, 0.222f);
|
|
_sjqModle.transform.localRotation = Quaternion.Euler(0, 180, 0);
|
|
|
|
|
|
_sjqPanelCtrl._ZhanKaiCall += () =>
|
|
{
|
|
_sjqModle.transform.localScale = Vector3.one;
|
|
_sjqModle.transform.localPosition = new Vector3(-0.042f, -0.011f, 0.222f);
|
|
};
|
|
_sjqPanelCtrl._ShouQiCall += () =>
|
|
{
|
|
_sjqModle.transform.localScale = Vector3.one * 0.5f;
|
|
_sjqModle.transform.localPosition = new Vector3(0.0046f, -0.0604f, 0.222f);
|
|
};
|
|
_sjqPanelCtrl._YinCangCall += () =>
|
|
{
|
|
_sjqModle.transform.localScale = Vector3.one * 0.0f;
|
|
_sjqModle.transform.localPosition = new Vector3(0.193f, -0.099f, 0.222f);
|
|
};
|
|
}
|
|
else
|
|
{
|
|
if (_sjqModle != null)
|
|
{
|
|
if (!StepManager.Instance.CurAZBSState.Equals("轴向校零"))
|
|
{
|
|
UI_Manage.Instance.ClosePanel("ShiJiaoQiTuLiCtrlPanel");
|
|
}
|
|
_sjqModle.transform.SetParent(transform);
|
|
_sjqModle.transform.localPosition = new Vector3(0.818208f, -0.05756009f, -25.92707f);
|
|
_sjqModle.transform.localRotation = Quaternion.Euler(0, 180, 0);
|
|
_sjqModle.transform.localScale = Vector3.one;
|
|
_sjqPanelCtrl = null;
|
|
_sjqModle = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private void SetTRAble(GameObject geo, Vector3 localpos, Vector3 localrot, bool show)
|
|
{
|
|
SetPos(geo, localpos);
|
|
SetRot(geo, localrot);
|
|
geo.SetActive(show);
|
|
}
|
|
private void SetPos(GameObject geo, Vector3 localpos)
|
|
{
|
|
geo.transform.localPosition = localpos;
|
|
}
|
|
private void SetRot(GameObject geo, Vector3 localrot)
|
|
{
|
|
geo.transform.localRotation = Quaternion.Euler(localrot);
|
|
}
|
|
}
|
|
} |