mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2025-06-10 22:20:40 +02:00
fix: add more sound effects + buttons scaling in editor mode
This commit is contained in:
@ -96,11 +96,11 @@ public class LevelEditor : MonoBehaviour
|
||||
var bg = canvas?.Find("BlankSquare");
|
||||
var icon = canvas?.Find("PrefabIcon");
|
||||
if (bg == null || icon == null) { Destroy(t.gameObject); return; }
|
||||
float xOff = -375f + idx * 125f;
|
||||
float xOff = -325f + idx * 125f;
|
||||
var bgRt = bg.GetComponent<RectTransform>();
|
||||
var icRt = icon.GetComponent<RectTransform>();
|
||||
bgRt.anchoredPosition = new Vector2(xOff, bgRt.anchoredPosition.y);
|
||||
icRt.anchoredPosition = new Vector2(xOff, icRt.anchoredPosition.y);
|
||||
bgRt.anchoredPosition = new Vector2(xOff, bgRt.anchoredPosition.y - 70);
|
||||
icRt.anchoredPosition = new Vector2(xOff, icRt.anchoredPosition.y - 70);
|
||||
bg.GetComponent<Image>().sprite = Resources.Load<Sprite>("InGame/ButtonSkin/BlankSquare");
|
||||
icon.GetComponent<Image>().sprite = prefab.GetComponent<SpriteRenderer>()?.sprite;
|
||||
icRt.sizeDelta = prefab.name.ToLower().Contains("small")
|
||||
|
@ -24,7 +24,10 @@ public class LevelLoader : MonoBehaviour
|
||||
private void LoadAudio()
|
||||
{
|
||||
musicSource.clip = Resources.Load<AudioClip>(Path.Combine("Musics", levelsLoader.levelCurrent.musicName));
|
||||
|
||||
if (editMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (PlayerPrefs.HasKey("Volume"))
|
||||
{
|
||||
musicSource.volume = PlayerPrefs.GetFloat("Volume");
|
||||
@ -67,19 +70,14 @@ public class LevelLoader : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// En mode jeu/test uniquement → ajout du AICollider
|
||||
if (!editMode)
|
||||
{
|
||||
if (prefab.CompareTag("Kill"))
|
||||
{
|
||||
Instantiate(
|
||||
Resources.Load<GameObject>("AICollider"),
|
||||
new Vector3(element.x - 1, element.y, 0),
|
||||
Quaternion.identity
|
||||
);
|
||||
}
|
||||
Instantiate(
|
||||
Resources.Load<GameObject>("AICollider"),
|
||||
new Vector3(element.x - 1, element.y, 0),
|
||||
Quaternion.identity
|
||||
);
|
||||
}
|
||||
|
||||
// Appliquer l'échelle personnalisée
|
||||
@ -102,12 +100,8 @@ public class LevelLoader : MonoBehaviour
|
||||
);
|
||||
groundInstance.transform.localScale = new Vector3(current.LastX / 5f * 2, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Mur de fin toujours placé
|
||||
GameObject winWall = GetPrefab("WinnerWall");
|
||||
if (winWall != null)
|
||||
{
|
||||
GameObject winWall = GetPrefab("WinnerWall");
|
||||
Instantiate(
|
||||
winWall,
|
||||
new Vector3(current.LastX, 0, 0),
|
||||
@ -127,8 +121,8 @@ public class LevelLoader : MonoBehaviour
|
||||
GameObject groundInstance = Instantiate(groundPrefab, new Vector3(current.LastX / 2, groundY, 0), Quaternion.identity);
|
||||
float groundWidth = current.LastX;
|
||||
groundInstance.transform.localScale = new Vector3(groundWidth / 5f * 2, 1, 1);
|
||||
Instantiate(GetPrefab("WinnerWall"), new Vector3(current.LastX, 0, 0), Quaternion.Euler(0, 0, 90));
|
||||
}
|
||||
Instantiate(GetPrefab("WinnerWall"), new Vector3(current.LastX, 0, 0), Quaternion.Euler(0, 0, 90));
|
||||
}
|
||||
|
||||
public void Start()
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
@ -7,6 +8,7 @@ public class PauseMenu : MonoBehaviour
|
||||
public GameObject pauseMenu;
|
||||
public GameObject pauseButton;
|
||||
public LevelLoader levelLoader;
|
||||
public AudioSource sfxSource;
|
||||
public Slider volumeSlider;
|
||||
|
||||
public void Start()
|
||||
@ -31,6 +33,9 @@ public class PauseMenu : MonoBehaviour
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
sfxSource.clip = Resources.Load<AudioClip>(Path.Combine("Sounds", "click"));
|
||||
sfxSource.Play();
|
||||
|
||||
Time.timeScale = 0;
|
||||
levelLoader.musicSource.Pause();
|
||||
|
||||
@ -41,11 +46,17 @@ public class PauseMenu : MonoBehaviour
|
||||
public void Home()
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
SceneManager.LoadScene("HomeScene");
|
||||
sfxSource.clip = Resources.Load<AudioClip>(Path.Combine("Sounds", "click"));
|
||||
sfxSource.Play();
|
||||
|
||||
StartCoroutine(LevelHomeButton.PlaySoundAndLoadScene(sfxSource, "HomeScene"));
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
sfxSource.clip = Resources.Load<AudioClip>(Path.Combine("Sounds", "click"));
|
||||
sfxSource.Play();
|
||||
|
||||
Time.timeScale = 1;
|
||||
levelLoader.musicSource.Play();
|
||||
|
||||
|
Reference in New Issue
Block a user