unityzgy/Assets/Scripts/ThisProjectTool/VRCtrl/RepairSub/StepNode/StepNodeAction/CheLun.cs
ayuan9957 bf12e02276 feat: 多语言本地化系统 - 支持中/英/法/俄实时切换
- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg)
- LoginPanel: InputField placeholder本地化、字体颜色保持
- HistoryPanel: 用时数据本地化、placeholder本地化
- RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建)
- AppraiseWindowBase: 评价等级本地化、操作消息重建
- EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized
- StudentOperateRecorder: 新增InjectOperateMsgLocalized方法
- LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选
- 字体切换时保留颜色和verticalOverflow
2026-07-16 10:05:59 +08:00

84 lines
2.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using VRTK;
//车轮交互类 激活时先按照whellCollider 位置显示能交互的车轮
public class CheLun : SimpleGrabGO
{
//public Transform thisChezhou;
//public Transform targetPosCheZhou;
public Transform onCarWheel;
HingeJoint thisHingeJoint;
float lastFrameRotateValue;
//与本物体协同旋转
public List<RotateWithWheel> rotateWithGOs= new List<RotateWithWheel>();
//开始时隐藏可交互车轮 等激活时显示
private void Start()
{
thisHingeJoint = this.GetComponent<HingeJoint>();
this.gameObject.SetActive(false);
lastFrameRotateValue = this.transform.localEulerAngles.x;
}
public override void Active(ProcessEnum stepName, UnityAction finishedEven)
{
onCarWheel.gameObject.SetActive(false);//隐藏原有车轮
this.gameObject.SetActive(true);//显示车轮
thisHingeJoint.connectedAnchor = onCarWheel.transform.position;
ProcessManager.Instance.RegisterStepFinishedEvent("制动螺栓", RealUnActive);
ProcessManager.Instance.RegisterStepFinishedEvent("千斤顶", RealUnActive);
thisCollider.enabled = true;
SetGrabInteractable(true);
}
//安装流程某些流程完成后 真正失去激活状态
void RealUnActive()
{
ProcessManager.Instance.RemoveStepFinishedEvent("制动螺栓", RealUnActive);
ProcessManager.Instance.RemoveStepFinishedEvent("千斤顶", RealUnActive);
this.gameObject.SetActive(false);//隐藏可交互车轮
onCarWheel.gameObject.SetActive(true);//显示原有车轮
SetGrabInteractable(false);
}
//车轮比较特殊 只要满足条件可以一直转动,无法通过流程退出激活
public override void UnActive(ProcessEnum stepName)
{
Debug.Log("车轮失去激活状态不做处理");
}
private void FixedUpdate()
{
//Debug.LogWarning(this.transform.localEulerAngles.x);
float changeValue = this.transform.localEulerAngles.x - lastFrameRotateValue;
if (Mathf.Abs(changeValue)>0.1f)
{
if (changeValue > 180)
{
//Debug.LogError(changeValue);
changeValue -= 360;
}
else if (changeValue < -180)
{
//Debug.LogError(changeValue);
changeValue += 360;
}
//Debug.Log(changeValue);
foreach (var item in rotateWithGOs)
{
item.DoRotate(changeValue);
}
}
lastFrameRotateValue = this.transform.localEulerAngles.x;
}
}