- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
57 lines
1.8 KiB
Plaintext
57 lines
1.8 KiB
Plaintext
namespace VRTK.Examples
|
|
{
|
|
using UnityEngine;
|
|
|
|
public class Openable_Door : VRTK_InteractableObject
|
|
{
|
|
public bool flipped = false;
|
|
public bool rotated = false;
|
|
|
|
private float sideFlip = -1;
|
|
private float side = -1;
|
|
private float smooth = 270.0f;
|
|
private float doorOpenAngle = -90f;
|
|
private bool open = false;
|
|
|
|
private Vector3 defaultRotation;
|
|
private Vector3 openRotation;
|
|
|
|
public override void StartUsing(VRTK_InteractUse usingObject)
|
|
{
|
|
base.StartUsing(usingObject);
|
|
SetDoorRotation(usingObject.transform.position);
|
|
SetRotation();
|
|
open = !open;
|
|
}
|
|
|
|
protected void Start()
|
|
{
|
|
defaultRotation = transform.eulerAngles;
|
|
SetRotation();
|
|
sideFlip = (flipped ? 1 : -1);
|
|
}
|
|
|
|
protected override void Update()
|
|
{
|
|
base.Update();
|
|
if (open)
|
|
{
|
|
transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(openRotation), Time.deltaTime * smooth);
|
|
}
|
|
else
|
|
{
|
|
transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(defaultRotation), Time.deltaTime * smooth);
|
|
}
|
|
}
|
|
|
|
private void SetRotation()
|
|
{
|
|
openRotation = new Vector3(defaultRotation.x, defaultRotation.y + (doorOpenAngle * (sideFlip * side)), defaultRotation.z);
|
|
}
|
|
|
|
private void SetDoorRotation(Vector3 interacterPosition)
|
|
{
|
|
side = ((rotated == false && interacterPosition.z > transform.position.z) || (rotated == true && interacterPosition.x > transform.position.x) ? -1 : 1);
|
|
}
|
|
}
|
|
} |