private void OnTriggerStay2D(Collider2D collision) { GameObject go = collision.gameObject; EnnemyState es = go.GetComponent <EnnemyState>(); if (es && !collision.isTrigger) { var Dir = GetComponentInParent <PlayerState>().IsFacingRight ? 1 : -1; es.OnDamage(Damage, Dir * Knockback); } }
void OnTriggerEnter2D(Collider2D other) { PlayerController pc = other.GetComponent <PlayerController>(); if (pc == null) { //PlayerController pc_ = other.GetComponentInParent<PlayerController>(); // Don't kill weapon :( //if(pc_ == null) Destroy(other.gameObject); EnnemyState es = other.GetComponent <EnnemyState>(); if (!!es) { es.OnDamage(9999999, 0); } } }