|
|
@ -5,7 +5,7 @@ using System.Collections.Generic; |
|
|
|
|
|
|
|
namespace SemiColinGames { |
|
|
|
class Player { |
|
|
|
public enum Pose { Walking, Standing, Crouching, Stretching, SwordSwing, Jumping }; |
|
|
|
private enum Pose { Walking, Standing, Crouching, Stretching, SwordSwing, Jumping }; |
|
|
|
|
|
|
|
private const int moveSpeed = 180; |
|
|
|
private const int jumpSpeed = -600; |
|
|
@ -41,10 +41,6 @@ namespace SemiColinGames { |
|
|
|
|
|
|
|
public int Facing { get; private set; } = 1; |
|
|
|
|
|
|
|
public Pose GetPose { |
|
|
|
get { return pose; } |
|
|
|
} |
|
|
|
|
|
|
|
public Point Position { get { return position; } } |
|
|
|
|
|
|
|
public void Update(float modelTime, History<Input> input, AABB[] collisionTargets) { |
|
|
@ -157,6 +153,25 @@ namespace SemiColinGames { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public float VisionRange { |
|
|
|
get { |
|
|
|
return 150; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Vector2 VisionRay { |
|
|
|
get { |
|
|
|
Vector2 ray = new Vector2(VisionRange * Facing, 0); |
|
|
|
if (pose == Pose.Stretching) { |
|
|
|
ray = ray.Rotate(Facing * FMath.DegToRad(-30)); |
|
|
|
} |
|
|
|
if (pose == Pose.Crouching) { |
|
|
|
ray = ray.Rotate(Facing * FMath.DegToRad(30)); |
|
|
|
} |
|
|
|
return ray; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Returns the desired (dx, dy) for the player to move this frame.
|
|
|
|
Vector2 HandleInput(float modelTime, History<Input> input) { |
|
|
|
Vector2 result = new Vector2() { |
|
|
|