protected override void Shoot() { // base.Shoot(); charging.Stop(); //GameObject bulletGO = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); for (int i = 0; i < bullets.Count; i++) { if (!bullets[i].activeInHierarchy) { GameObject _bullet = bullets[i]; ProjectileBase projectile = _bullet.GetComponent <ProjectileBase>(); _bullet.transform.position = firePoint.position; _bullet.transform.rotation = firePoint.rotation; _bullet.SetActive(true); UpdateBulletStatus(projectile); projectile.SetTarget(target); shoot.Play(); break; } } hasShot = true; chargingFXRate = initialChargingFXRate; chargingFXGO.SetActive(false); }
void OnTriggerEnter(Collider other) { projectile = other.transform.GetComponent <ProjectileBase>(); if (projectile != null) { projectile.transform.LookAt(blackHoleEnemy.transform); projectile.SetTarget(blackHoleEnemy.transform); projectile.SetSpeed(projectile.speed * .75f); } }
protected override void Shoot() { // base.Shoot(); charging.Stop(); //GameObject bulletGO = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); for (int i = 0; i < bullets.Count; i++) { if (!bullets[i].activeInHierarchy) { GameObject _bullet = bullets[i]; ProjectileBase projectile = _bullet.GetComponent <ProjectileBase>(); _bullet.transform.position = firePoint.position; _bullet.transform.rotation = firePoint.rotation; _bullet.SetActive(true); projectile.SetDamage(projectile.GetDamage() * currentChargeLevel); Debug.Log(projectile.GetDamage()); projectile.SetDurability(currentChargeLevel); projectile.SetTarget(target); shoot.Play(); break; } } }