void CheckAimNpcObj() { float dTime = Time.realtimeSinceStartup - TimeCheckAimNpcLast; if (dTime < 0.05f) { return; } TimeCheckAimNpcLast = Time.realtimeSinceStartup; if (PlayerScript == null) { return; } if (PlayerScript.GetAimNpcObj() == null) { if (AimNpcObj != null) { AimNpcObj = null; ChangeAimTran(null); } return; } if (PlayerScript.GetAimNpcObj() != AimNpcObj) { AimNpcObj = PlayerScript.GetAimNpcObj(); //改变距离主角最近的npc. ChangeAimTran(AimNpcObj.transform); } }