void OnTriggerEnter2D(Collider2D coll) { PlayerHP playerHP = coll.gameObject.GetComponent <PlayerHP>(); if ((playerHP != null) && (isGame)) { GetComponent <Animator>().Play("Death"); rb.velocity = new Vector2(0, 0); isGame = false; if (playerHP.HP > 0) { Information.Instance.CauseOfDeath = Message; } bool leftDamage = (xv < 0) ? true : false; playerHP.GetDamage(damage, leftDamage); CameraShake.Shake(1, 1, CameraShake.ShakeMode.XY); } if (coll.gameObject.GetComponent <SpriteRenderer>() != null) { if (coll.gameObject.CompareTag("BulletGround")) { GetComponent <Animator>().Play("Death"); rb.velocity = new Vector2(0, 0); if (Vector3.Distance(tr.position, Information.Instance.position) < 8f) { float power = (8f - Vector3.Distance(tr.position, Information.Instance.position)) / 8f; Vector2 dir = new Vector2(); dir.x = Information.Instance.position.x - tr.position.x; dir.y = Information.Instance.position.y - tr.position.y; if (ObserverHP.level > 0) { GameObject.FindWithTag("Player").GetComponent <Rigidbody2D>().velocity = dir.normalized * power * 2f; } CameraShake.Shake(power, power, CameraShake.ShakeMode.XY); } } } }