Skip to content

Commit

Permalink
Fix fast falling into ledge and jump resets
Browse files Browse the repository at this point in the history
  • Loading branch information
james7132 committed Jan 24, 2017
1 parent 72c2891 commit cf048d0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Assets/Dependencies/SmashBrew/Character/States/MovementState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ public enum CharacterFacingMode {

public Transform CurrentLedge {
get { return _currentLedge; }
set { _currentLedge = value; }
set {
_currentLedge = value;
CmdResetJumps();
}
}

void Start() {
Expand All @@ -150,12 +153,13 @@ struct MovementInfo {
}

void Update() {
if (!hasAuthority)
if (!isLocalPlayer)
return;

var movement = new MovementInfo { facing = Direction };
// If currently hanging from a edge
if (CurrentLedge != null) {
IsFastFalling = false;
var offset = LedgeTarget.position - transform.position;
transform.position = CurrentLedge.position - offset;
if (JumpCount != MaxJumpCount)
Expand Down Expand Up @@ -239,12 +243,6 @@ struct MovementInfo {
[Command]
void CmdSetDirection(bool direction) { _direction = direction; }

[ClientRpc]
public void RpcMove(Vector3 position, bool direction) {
transform.position = position;
Direction = direction;
}

void OnChangeDirection(bool direction) {
_direction = direction;
if (FacingMode == CharacterFacingMode.Rotation) {
Expand Down

0 comments on commit cf048d0

Please sign in to comment.