private void _CheckPlayer() { if (FindObjectOfType <PlayerController>().GetComponentInChildren <BoxCollider2D>().IsTouching(GetComponent <Collider2D>())) { if (FindObjectOfType <PlayerController>().should_play_swing) { should_die = true; } } if (should_die) { if (!now) { now = true; GetComponentInChildren <ParticleSystem>().Play(); } angle += 3.0f * Time.deltaTime; transform.rotation = Quaternion.EulerAngles(0.0f, 0.0f, angle); //Debug.Log(angle.ToString()); if (angle >= 90.0f * Mathf.Deg2Rad) { FindObjectOfType <PlayerController>().deathChannel.Play(); scoreController.AddKillToScore(); int rng = Random.Range(0, 100); if (rng <= 20) { Instantiate(dynamite, transform.position, Quaternion.identity); } Destroy(gameObject); FindObjectOfType <PlayerController>().kills++; } } }