コード例 #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player") && canTakeDamage)
     {
         healthscript.GetDamage(damage, false, cooldown);
     }
 }
コード例 #2
0
 void OnParticleCollision(GameObject other)
 {
     Debug.Log("Bruh");
     if (healthscript.GetDamage(1, false, 1f))
     {
         Instantiate(blood, PlayerPosition.position, Quaternion.identity);
     }
 }
コード例 #3
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         if (Item.Contain_Item("Key"))
         {
             Item.Remove_Item("Key");
             Destroy(gameObject);
         }
         else
         {
             HealthControl healthscript = GameObject.FindGameObjectWithTag("Player").GetComponent <HealthControl>();
             healthscript.GetDamage(healthscript.health, false, 1f);
         }
     }
 }