//创建检测体并执行检测 void CreateAndDetect() { //创建新的检测体 for (int i = 0; i < dctBodyArr.Length; i++) { JumpDetectorBody jdTemp = Instantiate(jd); jdTemp.name = "jd" + number++; jdTemp.transform.position = ai.boy.transform.position + Vector3.up; jdTemp.transform.SetParent(this.tempMother); jdTemp.Init(); float speedTmp = 1 - (1f / dctBodyArr.Length) * (i); if (ai.followStrategy.IsToRight()) { jdTemp.usedSpeed = speedTmp; jdTemp.Jump(speedTmp); } else { jdTemp.usedSpeed = -speedTmp; jdTemp.Jump(-speedTmp); } dctBodyArr[i] = jdTemp; } }
// Use this for initialization void Start() { ai = GameManager.Instance.boy.GetComponent <BoyAI>(); jd = transform.parent.Find("JumpDetectorBody").GetComponent <JumpDetectorBody>(); tempMother = GameManager.Instance.temp.transform; }