Exemplo n.º 1
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.name == "player")
     {
         Char2D myChar2D = FindObjectOfType <Char2D>();
         myChar2D.OnDamage(_attack);
         //피격 이펙트
     }
 }
Exemplo n.º 2
0
 public void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.name == "playe")
     {
         Char2D playerChar = FindObjectOfType <Char2D>();
         playerChar.OnDamage(_data._attack);
         GameObject effectGo = Instantiate(_effectPrefab);
         Vector3    charPos  = playerChar.transform.position;
         effectGo.transform.position = new Vector3(charPos.x, charPos.y, charPos.z);
     }
 }
Exemplo n.º 3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.name == "player")
     {
         if (collision is CircleCollider2D)
         {
             return;
         }
         {
             Char2D player = collision.gameObject.GetComponent <Char2D>();
             player.OnDamage(1);
         }
     }
 }