コード例 #1
0
 void OnCollisionEnter(Collision collision)
 {
     ContactPoint[] points = collision.contacts;
     foreach (ContactPoint point in points)
     {
         if (point.otherCollider.CompareTag("Player Sword") || point.otherCollider.CompareTag("Shuriken"))
         {
             if (this.gameObject.activeSelf)
             {
                 StartCoroutine(HitEffects(point.point));
                 bossGM.DamageBoss(damageFromCollision);
             }
         }
     }
 }
コード例 #2
0
 void OnCollisionEnter(Collision collision)
 {
     ContactPoint[] points = collision.contacts;
     foreach (ContactPoint point in points)
     {
         if (point.otherCollider.CompareTag("Player Sword") || point.otherCollider.CompareTag("Shuriken"))
         {
             if (this.gameObject.activeSelf)
             {
                 StartCoroutine(HitEffects(point.point));
                 currentHealth -= damageFromCollision;
                 bossGM.DamageBoss(bossDamageFromCollision);
                 if (currentHealth <= 0)
                 {
                     GameObject go = Instantiate(explosionPrefab, transform.position, Quaternion.identity);
                     Destroy(go, 3);
                     this.gameObject.SetActive(false);
                 }
             }
         }
     }
 }