最近的高粱高粱

This commit is contained in:
huqibin 2025-06-03 16:13:29 +08:00
parent a7a34958ed
commit 5585f90ff1
2 changed files with 18 additions and 4 deletions

View File

@ -47,16 +47,28 @@ public class StepState_2002 : StepState
else if (num == 2) else if (num == 2)
{ {
//¹¤×÷Ô¤Ô¼ //¹¤×÷Ô¤Ô¼
float disSorg = 100000000;
SorghumController targetSorg = null;
SorghumController[] sorghumControllers = GameObject.FindObjectsOfType<SorghumController>(); SorghumController[] sorghumControllers = GameObject.FindObjectsOfType<SorghumController>();
foreach (var item in sorghumControllers) foreach (var item in sorghumControllers)
{ {
if (item.State == SorghumState.Healthy) if (item.State == SorghumState.Healthy)
{ {
item.triggerName = "高粱_正常1"; float dis = Vector3.Distance(OfficeManager.Instance.firstPersonController.transform.position ,item.transform.position);
break; if (dis < disSorg)
{
targetSorg = item;
disSorg = dis;
}
//item.triggerName = "¸ßÁ»_Õý³£1";
//break;
} }
} }
if (targetSorg != null)
{
targetSorg.triggerName = "¸ßÁ»_Õý³£1";
}
//OfficeManager.Instance.mobileController.downIndex = 1; //OfficeManager.Instance.mobileController.downIndex = 1;
} }
@ -64,6 +76,7 @@ public class StepState_2002 : StepState
{ {
//¹¤×÷Ô¤Ô¼ //¹¤×÷Ô¤Ô¼
//OfficeManager.Instance.mobileController.downIndex = 1; //OfficeManager.Instance.mobileController.downIndex = 1;
SorghumController[] sorghumControllers = GameObject.FindObjectsOfType<SorghumController>(); SorghumController[] sorghumControllers = GameObject.FindObjectsOfType<SorghumController>();
foreach (var item in sorghumControllers) foreach (var item in sorghumControllers)
{ {

View File

@ -11,7 +11,8 @@ public class OfficeManager : SingletonMono<OfficeManager>
public GameObject currentTool; public GameObject currentTool;
public Transform spawnToolPos; public Transform spawnToolPos;
public Transform tMDTips; public Transform tMDTips;
[HideInInspector]
public FirstPersonController firstPersonController;
/// <summary> /// <summary>
/// ÊÖ»ú /// ÊÖ»ú
@ -20,7 +21,7 @@ public class OfficeManager : SingletonMono<OfficeManager>
//private FirstPersonController firstPersonController; //private FirstPersonController firstPersonController;
private void Start() private void Start()
{ {
//firstPersonController = GameObject.FindGameObjectWithTag("Player").GetComponent<FirstPersonController>(); firstPersonController = GameObject.FindGameObjectWithTag("Player").GetComponent<FirstPersonController>();
//firstPersonController.gameObject.SetActive(false); //firstPersonController.gameObject.SetActive(false);
//GameManager.EventMgr.AddEventListener(Enum_EventType.OfficeTimeLineOver, OfficeTimeLineOver); //GameManager.EventMgr.AddEventListener(Enum_EventType.OfficeTimeLineOver, OfficeTimeLineOver);
//GameManager.EventMgr.AddEventListener<bool>(Enum_EventType.PlayerCanMove, SwitchFirstPersonControllerMove); //GameManager.EventMgr.AddEventListener<bool>(Enum_EventType.PlayerCanMove, SwitchFirstPersonControllerMove);