private void OnCollisionEnter2D(Collision2D collision) { //Cuando toque con el enemigo. if (collision.gameObject.tag == "Ground") { Destroy(this.gameObject); } if (collision.gameObject.tag == "Enemy") { if (collision.gameObject.GetComponent <Enemy_Script>() != null) { Enemy_Script Hit = collision.gameObject.GetComponent <Enemy_Script>(); Hit.SendMessage("Bullet_Hit", 1); Destroy(this.gameObject); } } }
private void OnCollisionStay2D(Collision2D collision) { if (collision.gameObject.tag == "Enemy") { if (collision.gameObject.GetComponent <Enemy_Script>() != null) { Enemy_Script EnemyCollision = collision.gameObject.GetComponent <Enemy_Script>(); if (EnemyCollision.E_State == Enemy_Script.EnemyState.SnowBall) { Player_MoveSnowBall = true; if (Input.GetKeyDown(KeyCode.C)) { EnemyCollision.SendMessage("Impulse", transform.position.x); } } } } }