mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
State machine player is networked
small cleanups are still needed
This commit is contained in:
@@ -143,12 +143,17 @@ public class AerialStateManager : NetworkBehaviour
|
||||
}
|
||||
|
||||
void Update(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the update state from current state
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
if(moveController.enabled){
|
||||
|
||||
@@ -63,11 +63,17 @@ public class DashStateManager : NetworkBehaviour
|
||||
}
|
||||
|
||||
void Update(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the update state from current state
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
}
|
||||
|
||||
@@ -107,12 +107,15 @@ public class MoveStateManager : NetworkBehaviour
|
||||
slideUp = GetComponentInParent<Transform>().up; // get parents up direction
|
||||
distToGround = GetComponent<Collider>().bounds.extents.y; // set players distance to ground
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
Cursor.lockState = CursorLockMode.Locked; // Lock cursor on start if you are the local player
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calculates vel using driftVel will need to be relocated
|
||||
calculatedCurVel = driftVel.magnitude * 50f;
|
||||
|
||||
@@ -124,6 +127,8 @@ public class MoveStateManager : NetworkBehaviour
|
||||
|
||||
void FixedUpdate(){
|
||||
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
|
||||
|
||||
@@ -67,11 +67,17 @@ public class NitroStateManager : NetworkBehaviour
|
||||
}
|
||||
|
||||
void Update(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the update state from current state
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
}
|
||||
|
||||
@@ -72,11 +72,17 @@ public class OffenseStateManager : NetworkBehaviour
|
||||
}
|
||||
|
||||
void Update(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the update state from current state
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
|
||||
if (!IsLocalPlayer) { return; }
|
||||
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user