- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class AttachOnCollision_QR2 : MonoBehaviour
|
|
{
|
|
public QuickRope2 rope;
|
|
//public string connectableTag = "Player";
|
|
public KeyCode detachKey = KeyCode.Space;
|
|
public Transform checkDisPoint;//检查碰撞时目标可吊点位与吊钩的距离 避免任意位置都能吊起的情况
|
|
//public GUIText HUD = null;
|
|
private CraneInterGO attachedObject = null;
|
|
public bool isConnected = false;
|
|
|
|
|
|
void Update()
|
|
{
|
|
if (Input.GetKeyDown(detachKey))
|
|
{
|
|
if (isConnected) //已经吊起物体时 放下物体
|
|
{
|
|
rope.DetachObject(attachedObject.gameObject);
|
|
attachedObject.UnSling();
|
|
//if (HUD)
|
|
// HUD.text = "Hook Disconnected";
|
|
}
|
|
else if(attachedObject) //满足吊起条件 空格吊起一个物体
|
|
{
|
|
isConnected = true;
|
|
rope.AttachObject(attachedObject.gameObject, rope.Joints.Count - 1, false);
|
|
attachedObject.OnSling();
|
|
}
|
|
}
|
|
}
|
|
|
|
void OnCollisionEnter(Collision col)
|
|
{
|
|
if (isConnected)
|
|
return;
|
|
CraneInterGO craneInterGO = col.transform.GetComponent<CraneInterGO>();
|
|
if (!craneInterGO || !craneInterGO.isSlinged)
|
|
return;
|
|
if (Vector3.Distance(checkDisPoint.transform.position, craneInterGO.GetCraneAnchorPos()) >0.2f)
|
|
{
|
|
Debug.Log("起吊位置差过大");
|
|
return;
|
|
}
|
|
attachedObject = craneInterGO;
|
|
//if (HUD)
|
|
// HUD.text = "Hook Connected";
|
|
}
|
|
|
|
private void OnCollisionExit(Collision collision)
|
|
{
|
|
if (attachedObject&&collision.gameObject == attachedObject.gameObject)
|
|
{
|
|
attachedObject = null;
|
|
isConnected = false;
|
|
}
|
|
}
|
|
}
|