Skip to content

Commit 2a5d692

Browse files
author
C.J. Kimberlin
committed
Couple interface tweaks
1 parent 590abc9 commit 2a5d692

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

Assets/PC2D/Scripts/PlayerMotor2D.cs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ public class PlayerMotor2D : MonoBehaviour
5252
[Range(0f, 1f)]
5353
public float heavyInputThreshold = 0.5f;
5454

55-
// Set this to use a specific collider for checks instead of grabbing the collider from gameObject.collider2D.
56-
[HideInInspector]
57-
public Collider2D colliderToUse;
58-
5955
// Delegates, attach to these to get event calls.
6056
public Notification onDash;
6157
public Notification onDashEnd;
@@ -75,7 +71,8 @@ public enum MotorState
7571
Sliding,
7672
OnCorner,
7773
Clinging,
78-
Dashing
74+
Dashing,
75+
Frozen
7976
}
8077

8178
private Surface stuckTo = Surface.None;
@@ -189,9 +186,9 @@ public void ForceJump(float extraSpeed = 0)
189186
}
190187

191188
/**
192-
* Allows a double jump to occur. This only has effect if double jumps are allowed.
189+
* Resets a double jump to occur. This only has effect if double jumps are allowed.
193190
* */
194-
public void AllowDoubleJump()
191+
public void ResetDoubleJump()
195192
{
196193
jumping.doubleJumped = false;
197194
}
@@ -222,18 +219,6 @@ public void EndDash()
222219
dashing.forceEnd = true;
223220
}
224221

225-
public void SetFacingOffAxis(float axis)
226-
{
227-
if (axis < -inputThreshold)
228-
{
229-
facingLeft = true;
230-
}
231-
else if (axis > inputThreshold)
232-
{
233-
facingLeft = false;
234-
}
235-
}
236-
237222
void FixedUpdate()
238223
{
239224
// Frozen?
@@ -799,7 +784,7 @@ private float CalculateJumpSpeed()
799784
/**
800785
* Set the movement direction. Ideally this should be a normalized vector but could be larger for faster speeds. READONLY
801786
**/
802-
public Vector2 movementDir { set; private get; }
787+
public Vector2 movementDir { get; set; }
803788

804789
/**
805790
* Call this to get state information about the motor. This will be information such as if the object is in the air or on the ground. This can be used
@@ -810,7 +795,7 @@ private float CalculateJumpSpeed()
810795
/**
811796
* Since the motor needs to know the facing of the object, this information is made available to anyone else who might need it.
812797
**/
813-
public bool facingLeft { get; private set; }
798+
public bool facingLeft { get; set; }
814799

815800
/**
816801
* Set this true to have the motor fall faster. Set to false to fall at normal speeds.
@@ -859,6 +844,7 @@ public bool frozen
859844

860845
rigidbody2D.velocity = Vector2.zero;
861846
rigidbody2D.gravityScale = 0;
847+
motorState = MotorState.Frozen;
862848
}
863849
else
864850
{
@@ -891,6 +877,11 @@ public bool frozen
891877
* */
892878
public bool changeDrag { get; set; }
893879

880+
/**
881+
* Set this to use a specific collider for checks instead of grabbing the collider from gameObject.collider2D.
882+
* */
883+
public Collider2D colliderToUse { get; set; }
884+
894885
//
895886
// Debug
896887
//

0 commit comments

Comments
 (0)