IEnumerator WaitForTurn2ShotGun() { yield return(new WaitForSeconds(1)); ShotGunControler pick_shotGun = gameObject.GetComponentInChildren <ShotGunControler>(); if (_Target == null) { IdentifyTarget(); } pick_shotGun.throwBallAIEnemy(_Target.transform.position); }
IEnumerator WaitForHitPlayer(int indexPick, Vector3 vel) { yield return(new WaitForSeconds(1)); if (_GameControler._Level == 1) { int ran = Random.Range(1, 4); if (ran == 1) { int ranDir = 1; vel *= (ranDir * 1.2f); } } switch (indexPick) { case 0: //Lưu đạn Pick_GrenadeControler pick_grenade = gameObject.GetComponentInChildren <Pick_GrenadeControler>(); pick_grenade.throwBallAIEnemy(vel); break; case 1: //Slo ShotGunControler pick_shotGun = gameObject.GetComponentInChildren <ShotGunControler>(); if (_Target == null) { IdentifyTarget(); } pick_shotGun.throwBallAIEnemy(_Target.transform.position); StartCoroutine(WaitForTurn2ShotGun()); break; case 2: //Cối CannonScript pick_Bazoo = gameObject.GetComponentInChildren <CannonScript>(); pick_Bazoo.ThrowBallEnemy(vel); break; case 3: //Rocket AirCallControler pick_Bomp = gameObject.GetComponentInChildren <AirCallControler>(); pick_Bomp.Pick_BombEnemy(_Target.transform.position); break; case 4: Pick_DrillerControler pick_driller = gameObject.GetComponentInChildren <Pick_DrillerControler>(); pick_driller.throwBallEnemy(_Target.transform.position); break; case 5: break; case 6: break; //Tự dùng case 7: Pick_LaserControler pick_laser = gameObject.GetComponentInChildren <Pick_LaserControler>(); pick_laser.throwBallEnemy(_Target.transform.position); break; case 8: Pick_CarotControler pick_carrot = gameObject.GetComponentInChildren <Pick_CarotControler>(); pick_carrot.throwBallEnemy(vel); break; case 9: break; case 10: Pick_PunchControler pick_punch = gameObject.GetComponentInChildren <Pick_PunchControler>(); pick_punch.throwBallEnemy(_Target.transform.position); break; case 11: Pick_BowControler pick_bow = gameObject.GetComponentInChildren <Pick_BowControler>(); pick_bow.throwBallEnemy(vel); break; case 12: Pick_MinigunControler pick_minigun = gameObject.GetComponentInChildren <Pick_MinigunControler>(); pick_minigun.throwBallEnemy(_Target.transform.position); break; case 13: Pick_Grenade_PoisonControler pick_poison = gameObject.GetComponentInChildren <Pick_Grenade_PoisonControler>(); pick_poison.throwBallAIEnemy(vel); break; case 14: break; case 15: break; case 16: Pick_FlamethrowerControler pick_flame = gameObject.GetComponentInChildren <Pick_FlamethrowerControler>(); pick_flame.throwBallEnemy(_Target.transform.position); break; case 17: break; } }