//shoot bullet forward public override void Shoot(int shootPoint) { GameObject bullet = stockpile.GetBullet(bulletPrefab.name); bullet.transform.position = transform.position; bullet.transform.rotation = aim.transform.rotation; bullet.GetComponent <EnemyBullet>().Activate(bulletSpeed); }
//shoot bullet forward public override void Shoot(int shootPoint) { GameObject bullet; if (GameObject.Find("Bullets").GetComponent <BulletStockpile>()) { bullet = stockpile.GetBullet(bulletPrefab.name); } else { bullet = Instantiate(bulletPrefab); } bullet.transform.position = transform.position; bullet.transform.rotation = aim.transform.rotation; bullet.GetComponent <EnemyBullet>().Activate(bulletSpeed); }
//////////////////////////////////////////////////////////////// public void Shoot(int shootPoint) { //iterate through shootpoints foreach (Transform sp in shootPoints.GetChild(shootPoint)) { GameObject bullet = stockpile.GetBullet(bulletPrefabs[shootPoint].name); bullet.transform.position = sp.position; bullet.transform.rotation = sp.rotation; if (bullet.GetComponent <EnemyBullet>()) { bullet.GetComponent <EnemyBullet>().Activate(bulletSpeed); } else { bullet.transform.GetChild(0).GetComponent <EnemyBullet>().Activate(bulletSpeed); } } }
//////////////////////////////////////////////////////////////// //shoot bullet forward public override void Shoot(int shootPoint) { foreach (Transform sp in points[shootPoint]) { //////////////////////////////////////////////////////////////// GameObject bullet = stockpile.GetBullet(bulletPrefabs[shootPoint].name); bullet.transform.position = sp.position; bullet.transform.rotation = sp.rotation; //////////////////////////////////////////////////////////////// if (bullet.GetComponent <EnemyBullet>()) { bullet.GetComponent <EnemyBullet>().Activate(bulletSpeeds[shootPoint]); } else { bullet.transform.GetChild(0).GetComponent <EnemyBullet>().Activate(bulletSpeeds[shootPoint]); } //////////////////////////////////////////////////////////////// } }