void shieldDestroyed(ProjectileBlocker blocker) { //print("shieldDestroyed"); shieldExists = false; if(passiveOn) { Invoke("passiveDelegate",cooldown*2); } }
void shieldDestroyed(ProjectileBlocker blocker) { //print("shieldDestroyed"); shieldExists = false; if (passiveOn) { Invoke("passiveDelegate", cooldown * 2); } }
void addShield(Transform target) { if (!shieldExists) { GameObject shield = (GameObject)Instantiate(shieldPrefab, target.position, Quaternion.identity); Vector3 extents = target.collider2D.bounds.extents; float radius = Vector3.Magnitude(extents); shield.transform.localScale = new Vector3(radius * 2f, radius * 2f, 1); ProjectileBlocker script = shield.GetComponent <ProjectileBlocker>(); script.numCanBlock = (int)effectSize; script.destroyEvent += shieldDestroyed; shieldExists = true; shield.transform.parent = target; currentShield = shield; } }