public void HandleNpcYouLiangDian(int youLiangDianVal, Transform tranNpc) { if (JiFenJieMianCtrl.GetInstance() != null) { if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()) { return; } } int randVal = Random.Range(0, 100) % 4; int yldLvA = 4; //min int yldLvB = 9; //center if (youLiangDianVal <= yldLvA) { randVal = 0; } else if (youLiangDianVal > yldLvA && youLiangDianVal <= yldLvB) { randVal = 1; } else { randVal = 2; } //randVal = 1; //test YouLiangDianMoveCtrl scriptYLD = null; switch (randVal) { case 0: scriptYLD = XkGameCtrl.GetYLDMoveScript(YouLiangDengJi.Level_1); break; case 1: scriptYLD = XkGameCtrl.GetYLDMoveScript(YouLiangDengJi.Level_2); break; default: scriptYLD = XkGameCtrl.GetYLDMoveScript(YouLiangDengJi.Level_3); break; } Vector3 startPos = Vector3.zero; startPos = Camera.main.WorldToScreenPoint(tranNpc.position); startPos.z = 0f; startPos.x = (XkGameCtrl.ScreenWidth * startPos.x) / Screen.width; startPos.y = (XkGameCtrl.ScreenHeight * startPos.y) / Screen.height; //Debug.Log("startPos **** "+startPos); scriptYLD.StartMoveYouLiangDian(startPos, YLDEndPosTran.position); }