aboutsummaryrefslogtreecommitdiffstats
path: root/Assets/Scripts/Actors/Actor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Actors/Actor.cs')
-rw-r--r--Assets/Scripts/Actors/Actor.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Assets/Scripts/Actors/Actor.cs b/Assets/Scripts/Actors/Actor.cs
index bcee7a3..2e98974 100644
--- a/Assets/Scripts/Actors/Actor.cs
+++ b/Assets/Scripts/Actors/Actor.cs
@@ -14,7 +14,6 @@ namespace MontanaJohns.Actors
{
[SerializeField] protected float gravityScale = 1.5f;
[SerializeField] protected Stats baseStats = Stats.DefaultBaseStats();
- [SerializeField] protected LayerMask groundLayer;
[SerializeField] protected Transform groundCheckPoint;
protected Rigidbody2D _rigidBody;
@@ -26,8 +25,8 @@ namespace MontanaJohns.Actors
protected Active activeItem;
protected bool isGrappling;
protected Vector2? grapplePoint = null;
+ protected LayerMask groundLayers;
Collection<Item> items;
- bool isFalling;
public int health;
protected int jumpCount;
@@ -39,6 +38,7 @@ namespace MontanaJohns.Actors
_transform = GetComponent<Transform>();
_renderer = GetComponent<SpriteRenderer>();
_animator = GetComponent<Animator>();
+ groundLayers = LayerMask.GetMask("Grapple", "Ground");
}
protected virtual void Start()
@@ -55,7 +55,7 @@ namespace MontanaJohns.Actors
protected virtual void FixedUpdate()
{
- if (!_animator.GetBool("airborn") && !Physics2D.OverlapCircle(groundCheckPoint.position, 0.2f, groundLayer))
+ if (!_animator.GetBool("airborn") && !Physics2D.OverlapCircle(groundCheckPoint.position, 0.2f, groundLayers))
{
_animator.SetTrigger("fall");
StartCoroutine(Falling());
@@ -66,7 +66,7 @@ namespace MontanaJohns.Actors
{
var target = new Vector2(input * stats.speedMultiplier * 10, _rigidBody.velocity.y);
_rigidBody.velocity = Vector2.SmoothDamp(_rigidBody.velocity, target, ref acceleration, .05f);
- _animator.SetBool("moving", Mathf.Abs(_rigidBody.velocity.x) > 0.001);
+ _animator.SetBool("moving", Mathf.Abs(_rigidBody.velocity.x) > 1);
if (_rigidBody.velocity.x < -0.001)
_renderer.flipX = true;
@@ -127,7 +127,7 @@ namespace MontanaJohns.Actors
{
_animator.SetBool("airborn", true);
- while (_rigidBody.velocity.y > 0 || !Physics2D.OverlapCircle(groundCheckPoint.position, 0.2f, groundLayer))
+ while (_rigidBody.velocity.y > 0 || !Physics2D.OverlapCircle(groundCheckPoint.position, 0.2f, groundLayers))
{
yield return new WaitForFixedUpdate();
}