void OnTriggerEnter(Collider other) { if (other.tag.Equals("AI")) { //Debug.Log("aiaiiaiai"); AIcontroll tempa = other.GetComponent <AIcontroll>(); if (!tempa.ischangeclose) { CreateNewAwarrds(); tempa.ChangeClose(A_heater, A_weapon, A_shield); } } }
/// <summary> /// invokeRepeating调用 /// </summary> void CreatAi() { GameObject g = null; AIcontroll controll = null; int temp_aiIndex = Random.Range(0, borAIindex); int temp_bornpos = Random.Range(0, bornpos); if (ai_pool.ContainsKey(temp_aiIndex) && ai_pool[temp_aiIndex].Count > 0) { g = ai_pool[temp_aiIndex][0]; ai_pool[temp_aiIndex].Remove(g); controll = g.GetComponent <AIcontroll>(); g.SetActive(true); // ai_pool.Remove(ai_pool[temp][0]); } else { g = GameObject.Instantiate(ai_prefab[temp_aiIndex], destinations[temp_bornpos].position, Quaternion.identity) as GameObject; controll = g.AddComponent <AIcontroll>(); } // controll.Init(); aliveai.Add(controll); controll.issetdes = false; controll.isattack = false; controll.isalive = false; controll.msg = this; controll.ischangeclose = false; // controll.Bip01 = g.transform.FindChild("xiongdonghua/Bip01").gameObject; // controll.endpos = CreateAIendPos(); controll.endpos = ai_end_pos; controll.uppos = gateright.position; controll.look_gate = currentgate; // Debug.Log(controll.endpos); switch (temp_aiIndex) { case 0: controll.HP = 10; controll.InDex = 0; controll.ATTACK = 10; controll.gread = 10; break; case 1: controll.HP = 20; controll.InDex = 1; controll.ATTACK = 20; controll.gread = 20; break; case 2: controll.HP = 30; controll.InDex = 2; controll.ATTACK = 30; controll.gread = 30; break; default: break; } aliveAI++; /*实时监测AI数量*/ invokeCreatAI++; /*Boss生成数量依据*/ g.tag = ai_tag; // Debug.Log(temp_bornpos); g.transform.position = destinations[temp_bornpos].position; //Debug.Log("<color=yellow>AI生成位置序号" + temp_bornpos + destinations[temp_bornpos].position + "AI种类随机" + temp_aiIndex + "</color>"); }