Skip to content

Commit

Permalink
Fix loading screen animation
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed May 31, 2024
1 parent 9754e45 commit 926cb4b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Assets/Scenes/Menu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 785370674}
m_IndirectSpecularColor: {r: 0.061073616, g: 0.21100084, b: 0.4741943, a: 1}
m_IndirectSpecularColor: {r: 0.062290687, g: 0.21925586, b: 0.49511063, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down
9 changes: 8 additions & 1 deletion Assets/Scripts/Control&Input/Peer2PeerTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,17 @@ public static void StartTrainingMode()
private static IEnumerator WaitAndSwitchToTrainingMode()
{
LoadingScreen.Singleton.Show();

// Wait for player details to be populated
while (!NetworkClient.isConnected && !singleton.isNetworkActive && players.Count < PlayerInputManagerController.Singleton.LocalPlayerInputs.Count)
yield return new WaitForEndOfFrame();
singleton.ServerChangeScene(Scenes.TrainingMode);
// TODO until after spawned

yield return new WaitForSeconds(LoadingScreen.Singleton.MandatoryDuration);

// Wait for player(s) to have spawned
while (FindObjectsByType<PlayerManager>(FindObjectsSortMode.None).Count() < players.Count)
yield return new WaitForEndOfFrame();
LoadingScreen.Singleton.Hide();
}

Expand Down
8 changes: 5 additions & 3 deletions Assets/Scripts/LoadingScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class LoadingScreen : MonoBehaviour
[SerializeField] private float normalRotationSpeed = 60;
[SerializeField] private float fastRotationSpeed = 120;

private float incrementTimer = 360f;
private float rotationSpeed = 60;

private static int loadingCounter = 0;
Expand Down Expand Up @@ -76,13 +75,16 @@ private void Start()
private IEnumerator UpdateTimer(float duration)
{
var secondsPerChamber = duration / 6f;
var chamberCoverageAngle = 360f;
rotationSpeed = normalRotationSpeed;

radialTimer.material.SetFloat("_Arc2", chamberCoverageAngle);

for (int i = 0; i < 6; i++)
{
yield return new WaitForSeconds(secondsPerChamber);
incrementTimer -= 60f;
radialTimer.material.SetFloat("_Arc2", incrementTimer);
chamberCoverageAngle -= 60f;
radialTimer.material.SetFloat("_Arc2", chamberCoverageAngle);

if (i == 4)
{
Expand Down

0 comments on commit 926cb4b

Please sign in to comment.