fix character
This commit is contained in:
@@ -131,7 +131,7 @@ public abstract class Character : MonoBehaviour
|
||||
if (direction == Vector2.down)
|
||||
rayStartPoint = new Vector2(_capsuleCollider.bounds.center.x + direction.x / 2, _capsuleCollider.bounds.min.y - 0.1f);
|
||||
else
|
||||
rayStartPoint = new Vector2(_capsuleCollider.bounds.center.x, _capsuleCollider.bounds.min.y + 0.1f);
|
||||
rayStartPoint = new Vector2(_capsuleCollider.bounds.center.x, _capsuleCollider.bounds.min.y + 0.06f);
|
||||
var boundsSize = new Vector2(_capsuleCollider.bounds.size.x - 0.05f, 0.1f);
|
||||
|
||||
var raycastHit = Physics2D.BoxCast(rayStartPoint, boundsSize, 0f, direction, 0.1f, _mapLayer);
|
||||
|
||||
@@ -19,11 +19,11 @@ public class EnemyAI : Character
|
||||
float horizontal = 0;
|
||||
float vertical = 0;
|
||||
|
||||
if (Player.Instance.transform.position.x - transform.position.x < -0.05f && isAllowLeft)
|
||||
if (Player.Instance.transform.position.x - transform.position.x < -0.05f && isAllowLeft &&!_isOnLadder)
|
||||
{
|
||||
horizontal = -1;
|
||||
}
|
||||
else if (Player.Instance.transform.position.x - transform.position.x > 0.05f && isAllowRight)
|
||||
else if (Player.Instance.transform.position.x - transform.position.x > 0.05f && isAllowRight && !_isOnLadder)
|
||||
{
|
||||
horizontal = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user