燃起來 #186001
Replies: 1 comment
-
|
What you want is completely doable and your current logic is already very close. The main thing to understand is the order of responsibility between detection and execution. First, ui範圍偵測器 ui1 and ui範圍偵測器2 ui2 should only be responsible for detecting something. They should not control any UI themselves. Their job ends the moment they tell you “I found a target”. Second, once a target is detected, you must always work with the detected object, not your own player. That means taking the collider returned by the detector and treating it as the target player. Third, from that detected collider, you need to get the 準心ui component that belongs to that target. In many cases this component is on the root object, not the collider itself, so you may need to get it from the collider’s root. Fourth, after you have the target’s 準心ui, you call the appropriate method on it, such as 範圍判定() or 範圍判定2(). This ensures the crosshair logic runs on the detected person, not on yourself. Fifth, only when neither ui1 nor ui2 detects anything should you call 無判定() on your own 準心控制. This keeps your local crosshair in the default state when no target is detected. In short, the step by step flow is detect with ui1 or ui2, identify the detected target, fetch that target’s 準心ui, execute the target’s crosshair logic, and only fall back to your own crosshair when nothing is detected. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Copilot Feature Area
Copilot Workspace
Body
using Photon.Pun;
using UnityEngine;
public class 執行準心ui : MonoBehaviourPunCallbacks
{
[SerializeField] ui範圍偵測器 ui1;
[SerializeField] ui範圍偵測器2 ui2;
[SerializeField] 準心ui 準心控制;
[SerializeField] 死亡事件 死亡;
我希望 ui範圍偵測器 ui1,ui範圍偵測器2 ui2 ,偵測到後,是執行被偵測到的人身上的 準心ui 準心控制
Beta Was this translation helpful? Give feedback.
All reactions