feat(): 完成凹槽预制体

This commit is contained in:
2025-10-29 12:48:44 +08:00
parent 639f33daff
commit dda107e198
3 changed files with 158 additions and 8 deletions

View File

@@ -17,7 +17,8 @@ namespace Script.Gameplay.Facility
private void FixedUpdate()
{
if (!isOpenInEditor) return;
hasObject = Physics.CheckBox(transform.position + plateOffset, plateSize * 0.5f, Quaternion.identity, detectLayer);
hasObject = Physics.CheckBox(transform.position + plateOffset, plateSize * 0.5f, Quaternion.identity,
detectLayer);
if (hasObject != lastState)
{
SendSignal(hasObject, this.gameObject);
@@ -25,17 +26,18 @@ namespace Script.Gameplay.Facility
if (hasObject)
{
// 被压下动画
pressTopPrefab.transform.localPosition = new Vector3(0,0,0.1f);
if (pressTopPrefab != null)
pressTopPrefab.transform.localPosition = new Vector3(0, 0, 0.1f);
}
else
{
// 弹起动画
pressTopPrefab.transform.localPosition = new Vector3(0,0,1);
if (pressTopPrefab != null)
pressTopPrefab.transform.localPosition = new Vector3(0, 0, 1);
}
}
}
#if UNITY_EDITOR
private void OnDrawGizmosSelected()
{