character movement WIP
This commit is contained in:
@@ -60,24 +60,23 @@ public abstract class Character : MonoBehaviour
|
||||
|
||||
SetWalkingAnimation(h_movement != 0);
|
||||
|
||||
//_isOnLadder = mapElement == MapElementType.Ladder && leftCheck == MapElementType.Ladder && rightCheck== MapElementType.Ladder;
|
||||
_isOnLadder =leftCheck == MapElementType.Ladder && rightCheck== MapElementType.Ladder;
|
||||
|
||||
if (mapElement == MapElementType.Ladder || (leftCheck == MapElementType.Ladder && rightCheck == MapElementType.Ladder))
|
||||
if (leftCheck == MapElementType.Ladder && rightCheck == MapElementType.Ladder)
|
||||
{
|
||||
float v_movement = inputVertical;
|
||||
print($"On ladder v_speed {v_movement}");
|
||||
isAllowVertical = true;
|
||||
_isOnLadder = true;
|
||||
|
||||
//if (v_movement != 0)
|
||||
//{
|
||||
|
||||
if (v_movement != 0)
|
||||
{
|
||||
//if (v_movement > 0 && mapElement != MapElementType.Ladder)
|
||||
//{
|
||||
// v_movement = 0;
|
||||
//}
|
||||
|
||||
SetClimbingAnimation(v_movement != 0);
|
||||
//}
|
||||
}
|
||||
_body.velocity = new Vector2(h_movement * MovementSpeed, v_movement * MovementSpeed);
|
||||
|
||||
}
|
||||
@@ -121,10 +120,10 @@ 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 + direction.x / 2, _capsuleCollider.bounds.min.y );
|
||||
rayStartPoint = new Vector2(_capsuleCollider.bounds.center.x + direction.x / 2, _capsuleCollider.bounds.min.y+0.1f );
|
||||
var boundsSize = new Vector2(_capsuleCollider.bounds.size.x - 0.05f, 0.1f);
|
||||
|
||||
var raycastHit = Physics2D.BoxCast(rayStartPoint, boundsSize, 0f, direction, 1f, _mapLayer);
|
||||
var raycastHit = Physics2D.BoxCast(rayStartPoint, boundsSize, 0f, direction, 0.9f, _mapLayer);
|
||||
MapElementType returnValue;
|
||||
Color color = Color.red;
|
||||
if (raycastHit)
|
||||
|
||||
Reference in New Issue
Block a user