public void HitByProjectile(StandardProjectile proj) { currentHealth -= proj.damage; if (currentHealth <= 0) { GameObject.Destroy(gameObject); } }
// Update is called once per frame void Update() { timeSinceLastShot += Time.deltaTime; if (timeSinceLastShot >= refireRate && playerCtrl.isShooting) { timeSinceLastShot = 0.0f; for (int i = 0; i < numShots; ++i) { GameObject proj = Instantiate(projectilePrefab, transform.position, Quaternion.identity) as GameObject; StandardProjectile projInfo = proj.GetComponent <StandardProjectile>(); } } }