mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2025-06-10 22:20:40 +02:00
chore: clean up
This commit is contained in:
@ -50,7 +50,10 @@ public class LevelsLoader : MonoBehaviour
|
||||
|
||||
private void SaveLevelCurrent()
|
||||
{
|
||||
if (levelCurrent == null) return;
|
||||
if (levelCurrent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LevelStat levelStat = new()
|
||||
{
|
||||
@ -68,7 +71,10 @@ public class LevelsLoader : MonoBehaviour
|
||||
|
||||
public void NextLevel()
|
||||
{
|
||||
if (levels.Count == 0) return;
|
||||
if (levels.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int currentIndex = levels.IndexOf(levelCurrent);
|
||||
levelCurrent = levels[(currentIndex + 1) % levels.Count];
|
||||
@ -76,7 +82,10 @@ public class LevelsLoader : MonoBehaviour
|
||||
|
||||
public void PreviousLevel()
|
||||
{
|
||||
if (levels.Count == 0) return;
|
||||
if (levels.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int currentIndex = levels.IndexOf(levelCurrent);
|
||||
levelCurrent = levels[(currentIndex - 1 + levels.Count) % levels.Count];
|
||||
@ -84,7 +93,10 @@ public class LevelsLoader : MonoBehaviour
|
||||
|
||||
public void IncreaseTotalJumps()
|
||||
{
|
||||
if (levelCurrent == null) return;
|
||||
if (levelCurrent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
levelCurrent.TotalJumps += 1;
|
||||
SaveLevelCurrent();
|
||||
@ -92,7 +104,10 @@ public class LevelsLoader : MonoBehaviour
|
||||
|
||||
public void IncreaseTotalAttempts()
|
||||
{
|
||||
if (levelCurrent == null) return;
|
||||
if (levelCurrent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
levelCurrent.TotalAttempts += 1;
|
||||
SaveLevelCurrent();
|
||||
@ -100,7 +115,10 @@ public class LevelsLoader : MonoBehaviour
|
||||
|
||||
public int CalculateCurrentProgressionPercent(Vector3 playerPosition)
|
||||
{
|
||||
if (levelCurrent == null) return 0;
|
||||
if (levelCurrent == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float lastX = levelCurrent.LastX;
|
||||
GameObject winnerWallPrefab = Resources.Load<GameObject>("Prefabs/WinnerWall");
|
||||
@ -125,6 +143,8 @@ public class LevelsLoader : MonoBehaviour
|
||||
levels.Clear();
|
||||
LoadAllLevels();
|
||||
if (levels.Count > 0)
|
||||
{
|
||||
levelCurrent = levels[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ public class LevelHomeButton : MonoBehaviour
|
||||
public static IEnumerator PlaySoundAndLoadScene(AudioSource sfxSource, string scene)
|
||||
{
|
||||
yield return new WaitWhile(() => sfxSource.isPlaying);
|
||||
Time.timeScale = 1;
|
||||
SceneManager.LoadScene(scene);
|
||||
}
|
||||
|
||||
|
@ -105,11 +105,10 @@ public class Player : MonoBehaviour
|
||||
|
||||
if (collision.gameObject.CompareTag("Kill"))
|
||||
{
|
||||
|
||||
Time.timeScale = 0;
|
||||
sfxSource.clip = Resources.Load<AudioClip>(Path.Combine("Sounds", "death"));
|
||||
sfxSource.Play();
|
||||
StartCoroutine(LevelHomeButton.PlaySoundAndLoadScene(sfxSource, SceneManager.GetActiveScene().name));
|
||||
|
||||
}
|
||||
|
||||
if (collision.gameObject.CompareTag("Win"))
|
||||
|
@ -50,7 +50,6 @@ public class SelectDifficulty : MonoBehaviour
|
||||
|
||||
public void PreviousDifficulty()
|
||||
{
|
||||
Debug.Log("PreviousDifficulty called");
|
||||
if (currentDifficulty > MinDiff)
|
||||
{
|
||||
currentDifficulty--;
|
||||
@ -60,7 +59,6 @@ public class SelectDifficulty : MonoBehaviour
|
||||
|
||||
public void NextDifficulty()
|
||||
{
|
||||
Debug.Log("NextDifficulty called");
|
||||
if (currentDifficulty < MaxDiff)
|
||||
{
|
||||
currentDifficulty++;
|
||||
|
@ -50,7 +50,6 @@ public class StarsRenderer : MonoBehaviour
|
||||
{
|
||||
useManualMode = true;
|
||||
manualDifficulty = Mathf.Clamp(difficulty, 1, 5);
|
||||
Debug.Log($"[StarsRenderer] SetManualDifficulty → manualDifficulty = {manualDifficulty}");
|
||||
lastRenderedDifficulty = -1;
|
||||
RenderStarsInternal(manualDifficulty);
|
||||
}
|
||||
@ -74,7 +73,6 @@ public class StarsRenderer : MonoBehaviour
|
||||
|
||||
private void RenderStarsInternal(int difficulty)
|
||||
{
|
||||
Debug.Log($"[StarsRenderer] RenderStarsInternal → difficulté = {difficulty}", this);
|
||||
for (int i = starsContainer.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
var child = starsContainer.GetChild(i);
|
||||
|
Reference in New Issue
Block a user