63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using DragonLi.Core;
|
||
using Mirror;
|
||
using Unity.VisualScripting;
|
||
using UnityEngine;
|
||
|
||
public class TempHand : Launcher
|
||
{
|
||
private void OnTriggerEnter(Collider other)
|
||
{
|
||
if (other.CompareTag("TurretLeft"))
|
||
{
|
||
Debug.Log("触碰到左手");
|
||
EventDispatcher.TriggerEvent("HandLeftTrriger", true);
|
||
}
|
||
if (other.CompareTag("TurretRight"))
|
||
{
|
||
Debug.Log("触碰到右手");
|
||
|
||
EventDispatcher.TriggerEvent("HandRightTrriger", true);
|
||
}
|
||
}
|
||
|
||
// <20><><EFBFBD>ֱ<EFBFBD><D6B1>뿪<EFBFBD><EBBFAA>ǹ̨<C7B9><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χʱ
|
||
private void OnTriggerExit(Collider other)
|
||
{
|
||
if (other.CompareTag("TurretLeft"))
|
||
{
|
||
EventDispatcher.TriggerEvent("HandLeftTrriger", false);
|
||
}
|
||
if (other.CompareTag("TurretRight"))
|
||
{
|
||
EventDispatcher.TriggerEvent("HandRightTrriger", false);
|
||
}
|
||
}
|
||
|
||
|
||
public new void Update()
|
||
{
|
||
if (!isOwned)
|
||
{
|
||
return;
|
||
}
|
||
if(GameInit.Ins.self==null)
|
||
return;
|
||
// 左手
|
||
if (hand == HandType.Right)
|
||
{
|
||
// 同步左手位姿
|
||
transform.position = GameInit.Ins.self.RightHand.position;
|
||
transform.rotation = GameInit.Ins.self.RightHand.rotation;
|
||
}
|
||
|
||
if (hand == HandType.Left)
|
||
{
|
||
// 同步左手位姿
|
||
transform.position = GameInit.Ins.self.LeftHand.position;
|
||
transform.rotation = GameInit.Ins.self.LeftHand.rotation;
|
||
}
|
||
}
|
||
}
|