Skip to content

Commit

Permalink
Couple interface tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
C.J. Kimberlin committed Sep 19, 2014
1 parent 590abc9 commit 2a5d692
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions Assets/PC2D/Scripts/PlayerMotor2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ public class PlayerMotor2D : MonoBehaviour
[Range(0f, 1f)]
public float heavyInputThreshold = 0.5f;

// Set this to use a specific collider for checks instead of grabbing the collider from gameObject.collider2D.
[HideInInspector]
public Collider2D colliderToUse;

// Delegates, attach to these to get event calls.
public Notification onDash;
public Notification onDashEnd;
Expand All @@ -75,7 +71,8 @@ public enum MotorState
Sliding,
OnCorner,
Clinging,
Dashing
Dashing,
Frozen
}

private Surface stuckTo = Surface.None;
Expand Down Expand Up @@ -189,9 +186,9 @@ public void ForceJump(float extraSpeed = 0)
}

/**
* Allows a double jump to occur. This only has effect if double jumps are allowed.
* Resets a double jump to occur. This only has effect if double jumps are allowed.
* */
public void AllowDoubleJump()
public void ResetDoubleJump()
{
jumping.doubleJumped = false;
}
Expand Down Expand Up @@ -222,18 +219,6 @@ public void EndDash()
dashing.forceEnd = true;
}

public void SetFacingOffAxis(float axis)
{
if (axis < -inputThreshold)
{
facingLeft = true;
}
else if (axis > inputThreshold)
{
facingLeft = false;
}
}

void FixedUpdate()
{
// Frozen?
Expand Down Expand Up @@ -799,7 +784,7 @@ private float CalculateJumpSpeed()
/**
* Set the movement direction. Ideally this should be a normalized vector but could be larger for faster speeds. READONLY
**/
public Vector2 movementDir { set; private get; }
public Vector2 movementDir { get; set; }

/**
* 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
Expand All @@ -810,7 +795,7 @@ private float CalculateJumpSpeed()
/**
* Since the motor needs to know the facing of the object, this information is made available to anyone else who might need it.
**/
public bool facingLeft { get; private set; }
public bool facingLeft { get; set; }

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

rigidbody2D.velocity = Vector2.zero;
rigidbody2D.gravityScale = 0;
motorState = MotorState.Frozen;
}
else
{
Expand Down Expand Up @@ -891,6 +877,11 @@ public bool frozen
* */
public bool changeDrag { get; set; }

/**
* Set this to use a specific collider for checks instead of grabbing the collider from gameObject.collider2D.
* */
public Collider2D colliderToUse { get; set; }

//
// Debug
//
Expand Down

0 comments on commit 2a5d692

Please sign in to comment.