예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (collide == true)
     {
         timer -= Time.deltaTime;
     }
     if (timer <= 0)
     {
         Collider2D[] hits = Physics2D.OverlapCircleAll(new Vector2(transform.position.x, transform.position.y), blastradius);
         foreach (Collider2D en in hits)
         {
             if (en.tag == "Enemy")
             {
                 MinionManager min = en.GetComponent <MinionManager>();
                 min.Damage(100);
             }
             if (en.tag == "BOSS")
             {
                 BOSSManager boss = en.GetComponent <BOSSManager>();
                 boss.Damage(100);
             }
         }
         SoundManager.instance.PlaySingleNew(clip);
         Destroy(gameObject);
     }
 }
예제 #2
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "PlantForm")
     {
         Destroy(gameObject);
     }
     if (collision.gameObject.tag == "Enemy")
     {
         Destroy(gameObject);
         MinionManager Health = collision.gameObject.GetComponent <MinionManager>();
         Health.Damage(Damage);
     }
     if (collision.gameObject.tag == "BOSS")
     {
         Destroy(gameObject);
         BOSSManager BHealth = collision.gameObject.GetComponent <BOSSManager>();
         BHealth.Damage(Damage);
     }
     if (collision.gameObject.GetComponent <TurretHP>())
     {
         Debug.Log("hit");
         TurretHP Health = collision.gameObject.GetComponent <TurretHP>();
         Health.Damage(Damage);
     }
     if (collision.gameObject.GetComponent <EndGameTurret>())
     {
         EndGameTurret Health = collision.gameObject.GetComponent <EndGameTurret>();
         Health.Damage(Damage);
     }
 }