mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-27 21:04:23 -05:00
Runners Properly Despawn and Spectate After Map Completion
This commit is contained in:
@@ -11,6 +11,7 @@ GameObject:
|
||||
- component: {fileID: 5230684734098155361}
|
||||
- component: {fileID: 255294324943942806}
|
||||
- component: {fileID: 6123210648835258304}
|
||||
- component: {fileID: 6920299832463701243}
|
||||
m_Layer: 0
|
||||
m_Name: EndCollider
|
||||
m_TagString: Untagged
|
||||
@@ -57,3 +58,20 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 925d0476088cb6d4eba1571ae1d3ed00, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &6920299832463701243
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7903050775825061804}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
NetworkInstanceId: 0
|
||||
PrefabHash: 6377124632624268040
|
||||
PrefabHashGenerator: EndCollider
|
||||
AlwaysReplicateAsRoot: 0
|
||||
DontDestroyWithOwner: 0
|
||||
|
||||
@@ -148,7 +148,7 @@ GameObject:
|
||||
- component: {fileID: 4670258835641355805}
|
||||
m_Layer: 0
|
||||
m_Name: PlayerHUD
|
||||
m_TagString: Untagged
|
||||
m_TagString: RunnerHUD
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -165,8 +165,6 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 3977536925801158668}
|
||||
- {fileID: 4313498025161899914}
|
||||
- {fileID: 236091843188763586}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -201,8 +199,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
raceTimer: 30
|
||||
countdown_text: {fileID: 8450380190165699611}
|
||||
RunnerHUD: {fileID: 8140722858805320406}
|
||||
KingHUD: {fileID: 3634947091672077549}
|
||||
spectating_text: {fileID: 9093490155705374174}
|
||||
--- !u!114 &4670258835641355805
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -251,7 +248,7 @@ MonoBehaviour:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &3634947091672077549
|
||||
--- !u!1 &3655526608544523940
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -259,28 +256,132 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 236091843188763586}
|
||||
- component: {fileID: 1395310041248018566}
|
||||
- component: {fileID: 7646823212680830739}
|
||||
- component: {fileID: 9093490155705374174}
|
||||
m_Layer: 0
|
||||
m_Name: KingHUD
|
||||
m_Name: Spectating
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &236091843188763586
|
||||
Transform:
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1395310041248018566
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3634947091672077549}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_GameObject: {fileID: 3655526608544523940}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1623539175747816640}
|
||||
m_RootOrder: 2
|
||||
m_Father: {fileID: 3977536925801158668}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -694, y: -479}
|
||||
m_SizeDelta: {x: 540, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7646823212680830739
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3655526608544523940}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &9093490155705374174
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3655526608544523940}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text:
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 72
|
||||
m_fontSizeBase: 72
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &4398773266343119393
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -312,6 +413,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 7128711314615986883}
|
||||
- {fileID: 1395310041248018566}
|
||||
m_Father: {fileID: 1623539175747816640}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -381,33 +483,3 @@ MonoBehaviour:
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!1 &8140722858805320406
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4313498025161899914}
|
||||
m_Layer: 0
|
||||
m_Name: RunnerHUD
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &4313498025161899914
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8140722858805320406}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1623539175747816640}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
||||
@@ -119,8 +119,9 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 5a5d879591af1084ab5d3a35fcd53086, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
items: []
|
||||
networkItemList: []
|
||||
pStats: {fileID: 0}
|
||||
invMan: {fileID: 0}
|
||||
--- !u!114 &508183713705064073
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -386,13 +387,14 @@ GameObject:
|
||||
- component: {fileID: 7188906082643956516}
|
||||
- component: {fileID: 7188906082643956519}
|
||||
- component: {fileID: 4875054560273456582}
|
||||
- component: {fileID: 5274684649800829135}
|
||||
m_Layer: 3
|
||||
m_Name: PlayerCam
|
||||
m_TagString: PlayerCam
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7188906082643956518
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -414,7 +416,7 @@ Camera:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7188906082643956521}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
@@ -457,8 +459,21 @@ AudioListener:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7188906082643956521}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
--- !u!114 &4875054560273456582
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7188906082643956521}
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 394466212a506df4da8f22e46bd4e333, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
player: {fileID: 4814433541978696327}
|
||||
--- !u!114 &5274684649800829135
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -467,10 +482,45 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 7188906082643956521}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 394466212a506df4da8f22e46bd4e333, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: e96cb6065543e43c4a752faaa1468eb1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
player: {fileID: 4814433541978696327}
|
||||
FixedSendsPerSecond: 20
|
||||
AssumeSyncedSends: 1
|
||||
InterpolatePosition: 1
|
||||
SnapDistance: 10
|
||||
InterpolateServer: 1
|
||||
MinMeters: 0.15
|
||||
MinDegrees: 1.5
|
||||
ExtrapolatePosition: 0
|
||||
MaxSendsToExtrapolate: 5
|
||||
Channel:
|
||||
EnableRange: 0
|
||||
EnableNonProvokedResendChecks: 0
|
||||
DistanceSendrate:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 20
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 500
|
||||
value: 20
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &9219263970634874959
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -290,6 +290,8 @@ MonoBehaviour:
|
||||
PlayerPrefab: 0
|
||||
- Prefab: {fileID: 2124558898386980576, guid: 19c3c5fda3dc2b54d9275bb39ace73ec, type: 3}
|
||||
PlayerPrefab: 0
|
||||
- Prefab: {fileID: 7903050775825061804, guid: 3ec903bdbf186d042993c4adefa36fb2, type: 3}
|
||||
PlayerPrefab: 0
|
||||
PlayerPrefabHash:
|
||||
id: 0
|
||||
CreatePlayerPrefab: 0
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using MLAPI;
|
||||
using MLAPI.Messaging;
|
||||
using MLAPI.SceneManagement;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EndCollider : MonoBehaviour {
|
||||
public class EndCollider : NetworkBehaviour {
|
||||
|
||||
// When player collides with the trigger for the end zone
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
@@ -24,7 +25,7 @@ public class EndCollider : MonoBehaviour {
|
||||
// Player found
|
||||
|
||||
// Despawn them
|
||||
character.GetComponent<NetworkObject>().Despawn();
|
||||
character.GetComponent<NetworkObject>().Despawn(true);
|
||||
|
||||
// Update the player data such that Finished is true
|
||||
if (ServerGameNetPortal.Instance.clientIdToGuid.TryGetValue(serverRpcParams.Receive.SenderClientId, out string clientGuid)) {
|
||||
@@ -51,34 +52,43 @@ public class EndCollider : MonoBehaviour {
|
||||
}
|
||||
|
||||
if (allFinished) {
|
||||
//todo: if yes -> go to PostGame scene
|
||||
|
||||
// Go to the post game screen
|
||||
NetworkSceneManager.SwitchScene("PostGame");
|
||||
} else {
|
||||
GameObject[] playableCharactersPostRemove = GameObject.FindGameObjectsWithTag("Player");
|
||||
// Loop over all characters
|
||||
foreach (GameObject character in playableCharacters) {
|
||||
// Make sure we find the characters that aren't the one that just finished (subsequently calling the rpc)
|
||||
if (character.GetComponent<NetworkObject>().OwnerClientId != serverRpcParams.Receive.SenderClientId) {
|
||||
// Then grab their GUID
|
||||
if (ServerGameNetPortal.Instance.clientIdToGuid.TryGetValue(serverRpcParams.Receive.SenderClientId, out string clientGuid)) {
|
||||
// To verify they aren't the king
|
||||
if (ServerGameNetPortal.Instance.clientData[clientGuid].IsKing != true) {
|
||||
// Then call a client rpc to the finished player to enable the camera locally
|
||||
ClientRpcParams clientRpcParams = new ClientRpcParams {
|
||||
Send = new ClientRpcSendParams {
|
||||
TargetClientIds = new ulong[] { serverRpcParams.Receive.SenderClientId }
|
||||
}
|
||||
};
|
||||
|
||||
foreach (GameObject character in playableCharactersPostRemove) {
|
||||
if (character.name == "PlayerPrefab") {
|
||||
if (FindObject(character, "PlayerCam") == null)
|
||||
{
|
||||
Debug.LogError("NULL");
|
||||
EnableSpectatorCameraClientRPC(character.GetComponent<NetworkObject>().OwnerClientId, clientRpcParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//todo: update playerhud to also say SPECTATING
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject FindObject(GameObject parent, string name)
|
||||
{
|
||||
Transform[] trs = parent.GetComponentsInChildren<Transform>(true);
|
||||
foreach (Transform t in trs)
|
||||
{
|
||||
if (t.name == name)
|
||||
{
|
||||
return t.gameObject;
|
||||
[ClientRpc]
|
||||
private void EnableSpectatorCameraClientRPC(ulong otherRunnerClientID, ClientRpcParams clientRpcParams = default) {
|
||||
GameObject[] playableCharacters = GameObject.FindGameObjectsWithTag("Player");
|
||||
|
||||
foreach (GameObject character in playableCharacters) {
|
||||
if (character.GetComponent<NetworkObject>().OwnerClientId == otherRunnerClientID) {
|
||||
GameHandler.FindGameObjectInChildWithTag(character, "PlayerCam").GetComponent<Camera>().enabled = true;
|
||||
GameHandler.FindGameObjectInChildWithTag(character, "PlayerCam").GetComponent<AudioListener>().enabled = true;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
GameObject.FindGameObjectWithTag("RunnerHUD").GetComponent<PlayerHUD>().spectating_text.text = "SPECTATING";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,31 +11,12 @@ public class PlayerHUD : NetworkBehaviour
|
||||
[SerializeField] private int raceTimer;
|
||||
public TMP_Text countdown_text;
|
||||
|
||||
public GameObject RunnerHUD;
|
||||
public GameObject KingHUD;
|
||||
public TMP_Text spectating_text;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
countdown_text.text = "Time Remaining: 00:00";
|
||||
StartCoroutine(RaceTimeCountdown());
|
||||
|
||||
// Get all players in the scene
|
||||
GameObject[] playableCharacters = GameObject.FindGameObjectsWithTag("Player");
|
||||
|
||||
// Find our player and enable their hud respectively
|
||||
foreach (GameObject character in playableCharacters) {
|
||||
if (character.GetComponent<NetworkObject>().OwnerClientId == NetworkManager.Singleton.LocalClientId) {
|
||||
if (ServerGameNetPortal.Instance.clientIdToGuid.TryGetValue(NetworkManager.Singleton.LocalClientId, out string clientGuid)) {
|
||||
if (ServerGameNetPortal.Instance.clientData.TryGetValue(clientGuid, out PlayerData playerData)) {
|
||||
if (playerData.IsKing) {
|
||||
KingHUD.SetActive(true);
|
||||
} else {
|
||||
RunnerHUD.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator RaceTimeCountdown() {
|
||||
|
||||
@@ -35,7 +35,10 @@ public class GameHandler : NetworkBehaviour
|
||||
foreach (GameObject character in playableCharacters) {
|
||||
if (character.GetComponent<NetworkObject>().OwnerClientId == NetworkManager.Singleton.LocalClientId) {
|
||||
localPlayer = character;
|
||||
FindGameObjectInChildWithTag(character, "PlayerCam").SetActive(true);
|
||||
|
||||
FindGameObjectInChildWithTag(character, "PlayerCam").GetComponent<Camera>().enabled = true;
|
||||
FindGameObjectInChildWithTag(character, "PlayerCam").GetComponent<AudioListener>().enabled = true;
|
||||
FindGameObjectInChildWithTag(character, "PlayerCam").GetComponent<PlayerCam>().enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +66,7 @@ public class GameHandler : NetworkBehaviour
|
||||
}
|
||||
|
||||
// Only works for 1st generation children
|
||||
private static GameObject FindGameObjectInChildWithTag(GameObject parent, string tag) {
|
||||
public static GameObject FindGameObjectInChildWithTag(GameObject parent, string tag) {
|
||||
Transform t = parent.transform;
|
||||
|
||||
for (int i = 0; i < t.childCount; i++) {
|
||||
|
||||
@@ -137,6 +137,7 @@ PlayerSettings:
|
||||
bundleVersion: 0.1
|
||||
preloadedAssets:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
||||
@@ -10,6 +10,7 @@ TagManager:
|
||||
- HookPoint
|
||||
- Floor
|
||||
- Weather
|
||||
- RunnerHUD
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
@@ -43,7 +44,6 @@ TagManager:
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
m_SortingLayers:
|
||||
- name: UI_Backgrounds
|
||||
uniqueID: 378093239
|
||||
|
||||
Reference in New Issue
Block a user