protected override IEnumerator Shoot() { GameObject ar = Instantiate(bulletPrefab, transform.Find("Spawnpoint").position, transform.rotation); MuzzFlash.Play(); Artillery artillery = ar.GetComponent <Artillery>(); artillery.Target = Target; RoundsFired++; yield return(new WaitForSeconds(3f)); RoundFired = false; }
protected override void Shoot(int seconds) { if (seconds != SavedTime) { MuzzFlash.Play(); if (Physics.Raycast(transform.Find("Spawnpoint").position, transform.forward, out RaycastHit hit)) { if (hit.transform.CompareTag("Player")) { if (!Shield.ShieldActive) { Health.CurrentHealth -= 5f; } else { Shield.CurrentShield -= 5f; } } } SavedTime = seconds; } }