starting work on enemy ai
This commit is contained in:
@@ -18,13 +18,15 @@ public class Character : MonoBehaviour
|
||||
private bool _isFall;
|
||||
private bool _facingRight = true;
|
||||
|
||||
|
||||
protected bool isAllowVertical = true;
|
||||
protected bool isAllowHorisontal = true;
|
||||
private void Start()
|
||||
{
|
||||
_body = GetComponent<Rigidbody2D>();
|
||||
_boxCollider = GetComponent<BoxCollider2D>();
|
||||
}
|
||||
|
||||
|
||||
protected void MoveTo(float inputHorizontal,float inputVertical)
|
||||
{
|
||||
var groundCheck = Physics2D.BoxCast(_boxCollider.bounds.center, _boxCollider.bounds.size, 0f, Vector2.down, .1f, groundLayer);
|
||||
@@ -32,6 +34,8 @@ public class Character : MonoBehaviour
|
||||
float v_movement=0;
|
||||
if (groundCheck || _isOnLadder)
|
||||
{
|
||||
isAllowVertical = false;
|
||||
isAllowHorisontal = true;
|
||||
_isFall = false;
|
||||
float h_movement = inputHorizontal;
|
||||
if (h_movement > 0 && !_facingRight)
|
||||
@@ -47,6 +51,7 @@ public class Character : MonoBehaviour
|
||||
|
||||
if (IsLadder(Vector2.down))
|
||||
{
|
||||
isAllowVertical = true;
|
||||
_isOnLadder = true;
|
||||
v_movement=inputVertical;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user