void detect() { Vector3 _p = transform.position; if (transform.position.x < GameManager.game.LB.position.x) { _p.x = GameManager.game.LB.position.x; data.SetPlayerPos(playerData.Pos.left); body.velocity = Vector2.zero; data.SetAnimation("edge"); data.SetBodyRot(playerData.Pos.left); transform.localScale = new Vector3(0.2f, 0.2f, 1); } else if (transform.position.y < GameManager.game.LB.position.y) { _p.y = GameManager.game.LB.position.y; data.SetPlayerPos(playerData.Pos.down); body.velocity = Vector2.zero; data.SetAnimation("edge"); data.SetBodyRot(playerData.Pos.down); transform.localScale = new Vector3(0.2f, 0.2f, 1); } else if (transform.position.x > GameManager.game.RT.position.x) { _p.x = GameManager.game.RT.position.x; data.SetPlayerPos(playerData.Pos.right); body.velocity = Vector2.zero; data.SetAnimation("edge"); data.SetBodyRot(playerData.Pos.right); transform.localScale = new Vector3(0.2f, 0.2f, 1); } else if (transform.position.y > GameManager.game.RT.position.y) { _p.y = GameManager.game.RT.position.y; data.SetPlayerPos(playerData.Pos.up); body.velocity = Vector2.zero; data.SetAnimation("edge"); data.SetBodyRot(playerData.Pos.up); transform.localScale = new Vector3(0.2f, 0.2f, 1); } transform.position = _p; }