private void Awake()
    {
        bossBody = GetComponent <Rigidbody2D>();

        leftController  = partLeft.GetComponent <BossPartsController>();
        rightController = partRight.GetComponent <BossPartsController>();
    }
示例#2
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     // Destroy the projectile object if it isn't the player
     if (!collision.gameObject.CompareTag("Player"))
     {
         audioManager.PlaySound("DmgEnemy");
         if (collision.gameObject.CompareTag("Enemy"))
         {
             Destroy(collision.gameObject, 0.05f);
         }
         if (collision.gameObject.CompareTag("Block"))
         {
             Destroy(this.gameObject, 0.05f);
         }
         if (collision.gameObject.CompareTag("BossPart"))
         {
             BossPartsController parts = collision.GetComponent <BossPartsController>();
             if (parts != null)
             {
                 parts.TakeDamage();
             }
         }
     }
 }