mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 02:00:54 -05:00
State machine player is networked
small cleanups are still needed
This commit is contained in:
parent
dfd1687224
commit
f0936f4cee
|
|
@ -112,7 +112,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
RespawnPoint: {x: 435, y: 26, z: 573}
|
||||
runnerPrefab: {fileID: 7188906082087890177, guid: a9840baa4cc526b44bfef27c6fea042a, type: 3}
|
||||
runnerPrefab: {fileID: 3669633515805984294, guid: 1e178f956ddfe5143b2b9e77e76db7f0, type: 3}
|
||||
--- !u!114 &3183774617664554809
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: e5b0676ce8370104fb5e7e82c47fc7f8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
runnerPrefab: {fileID: 7188906082087890177, guid: a9840baa4cc526b44bfef27c6fea042a, type: 3}
|
||||
runnerPrefab: {fileID: 3669633515805984294, guid: 1e178f956ddfe5143b2b9e77e76db7f0, type: 3}
|
||||
kingPrefab: {fileID: 8183403963968820400, guid: d23bf55f2a40d494487eb188930f895d, type: 3}
|
||||
--- !u!114 &2718425332668433511
|
||||
MonoBehaviour:
|
||||
|
|
|
|||
5669
Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab
Normal file
5669
Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab.meta
Normal file
7
Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1e178f956ddfe5143b2b9e77e76db7f0
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -282,7 +282,7 @@ MonoBehaviour:
|
|||
- PostGame
|
||||
AllowRuntimeSceneChanges: 0
|
||||
NetworkPrefabs:
|
||||
- Prefab: {fileID: 7188906082087890184, guid: a9840baa4cc526b44bfef27c6fea042a, type: 3}
|
||||
- Prefab: {fileID: 2080873442886702253, guid: 1e178f956ddfe5143b2b9e77e76db7f0, type: 3}
|
||||
PlayerPrefab: 0
|
||||
- Prefab: {fileID: 8183403963968820413, guid: d23bf55f2a40d494487eb188930f895d, type: 3}
|
||||
PlayerPrefab: 0
|
||||
|
|
|
|||
|
|
@ -125,7 +125,11 @@ public class Pitfall : NetworkBehaviour
|
|||
GameHandler.FindGameObjectInChildWithTag(character, "PlayerCam").GetComponent<AudioListener>().enabled = true;
|
||||
GameHandler.FindGameObjectInChildWithTag(character, "PlayerCam").GetComponent<PlayerCam>().enabled = true;
|
||||
|
||||
character.GetComponentInChildren<PlayerMovement>().enabled = true;
|
||||
character.GetComponentInChildren<MoveStateManager>().enabled = true;
|
||||
character.GetComponentInChildren<DashStateManager>().enabled = true;
|
||||
character.GetComponentInChildren<NitroStateManager>().enabled = true;
|
||||
character.GetComponentInChildren<AerialStateManager>().enabled = true;
|
||||
character.GetComponentInChildren<OffenseStateManager>().enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,20 @@ public class GameHandler : NetworkBehaviour
|
|||
}
|
||||
|
||||
// Re-enable the runner movement
|
||||
if (localPlayer.GetComponentInChildren<PlayerMovement>() != null) {
|
||||
localPlayer.GetComponentInChildren<PlayerMovement>().enabled = true;
|
||||
if (localPlayer.GetComponentInChildren<MoveStateManager>() != null) {
|
||||
localPlayer.GetComponentInChildren<MoveStateManager>().enabled = true;
|
||||
}
|
||||
if (localPlayer.GetComponentInChildren<AerialStateManager>() != null) {
|
||||
localPlayer.GetComponentInChildren<AerialStateManager>().enabled = true;
|
||||
}
|
||||
if (localPlayer.GetComponentInChildren<OffenseStateManager>() != null) {
|
||||
localPlayer.GetComponentInChildren<OffenseStateManager>().enabled = true;
|
||||
}
|
||||
if (localPlayer.GetComponentInChildren<DashStateManager>() != null) {
|
||||
localPlayer.GetComponentInChildren<DashStateManager>().enabled = true;
|
||||
}
|
||||
if (localPlayer.GetComponentInChildren<NitroStateManager>() != null) {
|
||||
localPlayer.GetComponentInChildren<NitroStateManager>().enabled = true;
|
||||
}
|
||||
|
||||
// Re-enable the kings movement
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ public class PlayerCam : NetworkBehaviour
|
|||
|
||||
void Update ()
|
||||
{
|
||||
if (!IsLocalPlayer) { return; }
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
|
||||
offset = transform.parent.forward * rad.magnitude;
|
||||
transform.position = new Vector3((player.transform.position.x - offset.x),((player.transform.position.y - offset.y)+2),(player.transform.position.z - offset.z));
|
||||
transform.position = new Vector3((player.transform.position.x - offset.x),((player.transform.position.y - offset.y)+3),(player.transform.position.z - offset.z));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,31 +9,31 @@ EditorUserSettings:
|
|||
value: 22424703114646680e0b0227036c6f1f05033f2b212d68252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-1:
|
||||
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
|
||||
value: 22424703114646680e0b0227036c731f1415016439262f2434
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-2:
|
||||
value: 22424703114646680e0b0227036c731f1415016439262f2434
|
||||
value: 22424703114646680e0b0227036c6b19021b1d192f2d2835633c133af6f9
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-3:
|
||||
value: 22424703114646680e0b0227036c7b151b180b65093e273e12190f3cf6ef2021f2e225a7f234362820
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-4:
|
||||
value: 22424703114646680e0b0227036c7b151b180b65093e273e12190f3cf6ef2021f2e225a7f234362820
|
||||
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
|
||||
value: 22424703114646703f313f3611314b0506241b2f222d69032e2c1336add32039f0f323f9d4393a323c34bf6d4a2b0f36e613
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-6:
|
||||
value: 22424703114646703f313f3611314b0506241b2f222d69032e2c1336add32039f0f323f9d4393a323c34bf6d4a2b0f36e613
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-7:
|
||||
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
||||
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-8:
|
||||
value: 22424703114646703f313f3611314b0506241b2f222d69032e2c1336add32039f0f323f9d4393a323c34bf6d4a2b0f36e613
|
||||
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-9:
|
||||
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
|
||||
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user