└── Scripts ├── CantMove.cs ├── CantMove.cs.meta ├── Champi.cs ├── Champi.cs.meta ├── DeadKing.cs ├── DeadKing.cs.meta ├── Death.cs ├── Death.cs.meta ├── EnemyRunLeft.cs ├── EnemyRunLeft.cs.meta ├── FadeOut.cs ├── FadeOut.cs.meta ├── FreezeTransfo.cs ├── FreezeTransfo.cs.meta ├── LuneTombe.cs ├── LuneTombe.cs.meta ├── Menu.cs ├── Menu.cs.meta ├── MusicBinaire.cs ├── MusicBinaire.cs.meta ├── MusicDepart.cs ├── MusicDepart.cs.meta ├── MusicFuite.cs ├── MusicFuite.cs.meta ├── MusicIncongru.cs ├── MusicIncongru.cs.meta ├── MusicManager.cs ├── MusicManager.cs.meta ├── MusicMenace.cs ├── MusicMenace.cs.meta ├── MusicMoon.cs ├── MusicMoon.cs.meta ├── MusicViolon.cs ├── MusicViolon.cs.meta ├── PauseMenu.cs ├── PauseMenu.cs.meta ├── PlaySoundCollider.cs ├── PlaySoundCollider.cs.meta ├── PlayerDisappear.cs ├── PlayerDisappear.cs.meta ├── SoundPatrol.cs ├── SoundPatrol.cs.meta ├── SoundPlayer.cs └── SoundPlayer.cs.meta /Scripts/CantMove.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class CantMove : MonoBehaviour 6 | { 7 | Rigidbody2D rigBod; 8 | // Start is called before the first frame update 9 | void Start() 10 | { 11 | rigBod = GetComponent(); 12 | rigBod.constraints = RigidbodyConstraints2D.FreezePositionX; 13 | } 14 | 15 | // Update is called once per frame 16 | void Update() 17 | { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Scripts/CantMove.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26e2a604b10899c4f824c88a5e8b0df8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/Champi.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Champi : MonoBehaviour 6 | { 7 | public GameObject champ; 8 | public GameObject spawner; 9 | public GameObject champTop; 10 | 11 | [SerializeField] 12 | private float wait; 13 | 14 | private Animation anim; 15 | 16 | private bool cooldown = false; 17 | // Start is called before the first frame update 18 | void Start() 19 | { 20 | 21 | } 22 | 23 | // Update is called once per frame 24 | void Update() 25 | { 26 | if (Input.GetButtonDown("Fire1") && (cooldown == false)) 27 | { 28 | cooldown = true; 29 | StartCoroutine(Attendre()); 30 | Attendre(); 31 | } 32 | } 33 | 34 | void Champignon() 35 | { 36 | anim = champTop.GetComponentInChildren(); 37 | Instantiate(champ, spawner.transform.position, transform.rotation); 38 | anim.Play(); 39 | } 40 | 41 | IEnumerator Attendre() 42 | { 43 | yield return new WaitForSeconds(wait); 44 | Champignon(); 45 | yield return new WaitForSeconds(1.5f); 46 | cooldown = false; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Scripts/Champi.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c57a7811a44bdd846957d2f04df60339 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/DeadKing.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class DeadKing : MonoBehaviour 6 | { 7 | public bool kingDead = false; 8 | public SpriteRenderer image; 9 | public GameObject explosion; 10 | public GameObject spawn1; 11 | public GameObject spawn2; 12 | public GameObject spawn3; 13 | public GameObject enemy1; 14 | public GameObject enemy2; 15 | public GameObject enemy3; 16 | 17 | public MusicFuite musique; 18 | 19 | // Start is called before the first frame update 20 | void Start() 21 | { 22 | image = GetComponent(); 23 | } 24 | 25 | // Update is called once per frame 26 | void Update() 27 | { 28 | 29 | } 30 | 31 | private void OnTriggerEnter2D(Collider2D collision) 32 | { 33 | if (collision.gameObject.name == "AttackHitBox") 34 | { 35 | Instantiate(explosion, transform.position, transform.rotation); 36 | image.color = new Color(0, 0, 0, 0); 37 | kingDead = true; 38 | Instantiate(enemy1, spawn1.transform.position, spawn1.transform.rotation); 39 | Instantiate(enemy2, spawn2.transform.position, spawn2.transform.rotation); 40 | Instantiate(enemy3, spawn3.transform.position, spawn3.transform.rotation); 41 | GetComponent().enabled = false; 42 | musique.music.Play(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Scripts/DeadKing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eac31b6e15311944d85541003e44283a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/Death.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.SceneManagement; 5 | 6 | public class Death : MonoBehaviour 7 | { 8 | [SerializeField] 9 | GameObject player; 10 | [SerializeField] 11 | GameObject explosion; 12 | 13 | Scene scene; 14 | 15 | void Start() 16 | { 17 | scene = SceneManager.GetActiveScene(); 18 | Debug.Log("Active Scene name is: " + scene.name + "\nActive Scene index: " + scene.buildIndex); 19 | } 20 | 21 | private void OnTriggerEnter2D(Collider2D collision) 22 | { 23 | if (collision.gameObject.tag == "Player") 24 | { 25 | Destroy(player); 26 | Instantiate(explosion, player.transform.position, player.transform.rotation); 27 | //SceneManager.LoadScene(scene.buildIndex, LoadSceneMode.Single); 28 | Debug.Log("mort"); 29 | StartCoroutine(coroutine()); 30 | } 31 | } 32 | 33 | private void OnCollisionEnter2D(Collision2D collision) 34 | { 35 | if (collision.gameObject.tag == "Player") 36 | { 37 | Destroy(player); 38 | Instantiate(explosion, player.transform.position, player.transform.rotation); 39 | //SceneManager.LoadScene(scene.buildIndex, LoadSceneMode.Single); 40 | Debug.Log("mort"); 41 | StartCoroutine(coroutine()); 42 | } 43 | } 44 | 45 | private IEnumerator coroutine() 46 | { 47 | yield return new WaitForSeconds(1.0f); 48 | SceneManager.LoadScene(scene.buildIndex, LoadSceneMode.Single); 49 | } 50 | 51 | private void Reload() 52 | { 53 | SceneManager.LoadScene(scene.buildIndex, LoadSceneMode.Single); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Scripts/Death.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 51d9f636281cb1b4ea5fca2c189c96a6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/EnemyRunLeft.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class EnemyRunLeft : MonoBehaviour 6 | { 7 | //public RigidBody2D rb; 8 | private bool moveRight; 9 | 10 | // Start is called before the first frame update 11 | void Start() 12 | { 13 | 14 | } 15 | 16 | // Update is called once per frame 17 | void Update() 18 | { 19 | transform.localScale = new Vector3(1.3f, 1.15f, 1f); 20 | gameObject.GetComponent().velocity = new Vector2(-7, gameObject.GetComponent().velocity.y); 21 | } 22 | } -------------------------------------------------------------------------------- /Scripts/EnemyRunLeft.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7317ebb5f7a66043be27c558f990d14 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/FadeOut.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using UnityEngine.SceneManagement; 6 | 7 | public class FadeOut : MonoBehaviour 8 | { 9 | public float waitFor; 10 | Scene scene; 11 | 12 | void Start() 13 | { 14 | Fade(); 15 | scene = SceneManager.GetActiveScene(); 16 | } 17 | public void Fade() 18 | { 19 | StartCoroutine(DoFade()); 20 | } 21 | 22 | IEnumerator DoFade() 23 | { 24 | yield return new WaitForSeconds(waitFor); 25 | CanvasGroup canvasGroup = GetComponent(); 26 | while (canvasGroup.alpha < 1) 27 | { 28 | canvasGroup.alpha += Time.deltaTime / 2; 29 | yield return null; 30 | } 31 | canvasGroup.interactable = false; 32 | yield return null; 33 | SceneManager.LoadScene((scene.buildIndex + 1), LoadSceneMode.Single); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Scripts/FadeOut.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: afd847720a4de114b9f66b70374a3eb4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/FreezeTransfo.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class FreezeTransfo : MonoBehaviour 5 | { 6 | 7 | Rigidbody2D rigBod; 8 | //Rigidbody2D originalConstraints; 9 | //new Vector3 posX; 10 | private bool freeze; 11 | 12 | // Use this for initialization 13 | void Start() 14 | { 15 | rigBod = GetComponent(); 16 | //originalConstraints = GetComponent(); 17 | } 18 | 19 | // Update is called once per frame 20 | void Update() 21 | { 22 | //posX = new Vector3(GameObject.transform.position.x); 23 | if (freeze) 24 | { 25 | //transform.Translate(Vector3.right * 0f); 26 | } 27 | } 28 | 29 | void FreezeT() 30 | { 31 | rigBod.constraints = RigidbodyConstraints2D.FreezePositionX; 32 | rigBod.constraints = RigidbodyConstraints2D.FreezeRotation; 33 | freeze = true; 34 | } 35 | 36 | void UnfreezeT() 37 | { 38 | freeze = false; 39 | rigBod.constraints &= ~RigidbodyConstraints2D.FreezePositionX; 40 | rigBod.constraints = RigidbodyConstraints2D.FreezeRotation; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Scripts/FreezeTransfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf523db938aff934b8c0eafb090cd313 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/LuneTombe.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.SceneManagement; 5 | 6 | public class LuneTombe : MonoBehaviour 7 | { 8 | public GameObject vaisseau; 9 | private Animator anim; 10 | 11 | private MusicFuite musique; 12 | // Start is called before the first frame update 13 | void Start() 14 | { 15 | anim = vaisseau.GetComponent(); 16 | anim.enabled = false; 17 | 18 | musique = GameObject.Find("MusicKingFuite").GetComponent(); 19 | } 20 | 21 | // Update is called once per frame 22 | void Update() 23 | { 24 | 25 | } 26 | void OnCollisionEnter2D(Collision2D collision) 27 | { 28 | if (collision.gameObject.tag == "Player") 29 | { 30 | collision.gameObject.transform.position = new Vector3(0, 30, 0); 31 | anim.enabled = true; 32 | StartCoroutine(coroutine()); 33 | musique.music.Stop(); 34 | } 35 | } 36 | IEnumerator coroutine() 37 | { 38 | yield return new WaitForSeconds(3.4f); 39 | SceneManager.LoadScene("Escape04", LoadSceneMode.Single); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Scripts/LuneTombe.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63cd8c7af33a9904ba523687dbb89ffb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/Menu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.SceneManagement; 5 | 6 | public class Menu : MonoBehaviour 7 | { 8 | // Start is called before the first frame update 9 | void Start() 10 | { 11 | 12 | } 13 | 14 | // Update is called once per frame 15 | void Update() 16 | { 17 | 18 | } 19 | 20 | public void StartGame() 21 | { 22 | SceneManager.LoadScene("Ville01", LoadSceneMode.Single); 23 | } 24 | 25 | public void QuitGame() 26 | { 27 | Application.Quit(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Scripts/Menu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96d514dc6ffd0b04aa16181f126ed9d7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicBinaire.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicBinaire : MonoBehaviour 6 | { 7 | public AudioSource music; 8 | public AudioClip clip; 9 | 10 | static bool AudioBegin = false; 11 | 12 | void Awake() 13 | { 14 | if (!AudioBegin) 15 | { 16 | music.Play(); 17 | StartCoroutine("fadeIn"); 18 | DontDestroyOnLoad(gameObject); 19 | AudioBegin = true; 20 | } 21 | if (music == null) 22 | { 23 | music = GetComponent(); 24 | } 25 | } 26 | void Update() 27 | { 28 | if (Application.loadedLevelName == "Moon10") 29 | { 30 | //music.Stop(); 31 | StartCoroutine("fadeSound"); 32 | 33 | AudioBegin = false; 34 | } 35 | } 36 | 37 | IEnumerator fadeSound() 38 | { 39 | while (music.volume > 0.01f) 40 | { 41 | music.volume -= Time.deltaTime / 3; 42 | yield return null; 43 | } 44 | music.volume = 0; 45 | music.Stop(); 46 | } 47 | 48 | IEnumerator fadeIn() 49 | { 50 | while (music.volume < 0.2f) 51 | { 52 | music.volume += Time.deltaTime / 3; 53 | yield return null; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Scripts/MusicBinaire.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fba75a0cee384a44ab5ec12dbb9a21c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicDepart.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicDepart : MonoBehaviour 6 | { 7 | AudioSource music; 8 | 9 | static bool AudioBegin = false; 10 | 11 | void Start() 12 | { 13 | music = GetComponent(); 14 | } 15 | 16 | void Awake() 17 | { 18 | if (!AudioBegin) 19 | { 20 | //music.Play(); 21 | DontDestroyOnLoad(gameObject); 22 | AudioBegin = true; 23 | } 24 | } 25 | void Update() 26 | { 27 | if (Application.loadedLevelName == "Moon03") 28 | { 29 | //music.Stop(); 30 | StartCoroutine("fadeSound"); 31 | 32 | AudioBegin = false; 33 | } 34 | } 35 | 36 | IEnumerator fadeSound() 37 | { 38 | while (music.volume > 0.01f) 39 | { 40 | music.volume -= Time.deltaTime / 2; 41 | yield return null; 42 | } 43 | music.volume = 0; 44 | music.Stop(); 45 | } 46 | } -------------------------------------------------------------------------------- /Scripts/MusicDepart.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f4c9517c2a7f8f49907bd79f80bb9eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicFuite.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicFuite : MonoBehaviour 6 | { 7 | public AudioSource music; 8 | 9 | //public DeadKing roi; 10 | 11 | static bool AudioBegin = false; 12 | 13 | void Start() 14 | { 15 | music = GetComponent(); 16 | } 17 | 18 | void Awake() 19 | { 20 | if (!AudioBegin) 21 | { 22 | DontDestroyOnLoad(gameObject); 23 | AudioBegin = true; 24 | } 25 | } 26 | void Update() 27 | { 28 | /*if (roi.kingDead == true) 29 | { 30 | music.Play(); 31 | roi.kingDead = false; 32 | }*/ 33 | /*if (Application.loadedLevelName == "Escape04") 34 | { 35 | music.Stop(); 36 | AudioBegin = false; 37 | }*/ 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Scripts/MusicFuite.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e381bd5b3c1eb846a66c9d1a4e56948 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicIncongru.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicIncongru : MonoBehaviour 6 | { 7 | public AudioSource music; 8 | public AudioClip clip; 9 | 10 | static bool AudioBegin = false; 11 | 12 | void Awake() 13 | { 14 | if (!AudioBegin) 15 | { 16 | music.Play(); 17 | StartCoroutine("fadeIn"); 18 | DontDestroyOnLoad(gameObject); 19 | AudioBegin = true; 20 | } 21 | if (music == null) 22 | { 23 | music = GetComponent(); 24 | } 25 | } 26 | void Update() 27 | { 28 | if (Application.loadedLevelName == "Moon16") 29 | { 30 | //music.Stop(); 31 | StartCoroutine("fadeSound"); 32 | 33 | AudioBegin = false; 34 | } 35 | } 36 | 37 | IEnumerator fadeSound() 38 | { 39 | while (music.volume > 0.01f) 40 | { 41 | music.volume -= Time.deltaTime / 3; 42 | yield return null; 43 | } 44 | music.volume = 0; 45 | music.Stop(); 46 | } 47 | 48 | IEnumerator fadeIn() 49 | { 50 | while (music.volume < 0.2f) 51 | { 52 | music.volume += Time.deltaTime / 8; 53 | yield return null; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Scripts/MusicIncongru.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d36f27fe2c48a77478c1507e3cf8935c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicManager : MonoBehaviour 6 | { 7 | public AudioSource music; 8 | public AudioClip clip; 9 | 10 | static bool AudioBegin = false; 11 | 12 | /*void Start() 13 | { 14 | music = GetComponent(); 15 | }*/ 16 | 17 | void Awake() 18 | { 19 | if (!AudioBegin) 20 | { 21 | //music.Play(); 22 | StartCoroutine("fadeIn"); 23 | DontDestroyOnLoad(gameObject); 24 | AudioBegin = true; 25 | } 26 | if (music == null) 27 | { 28 | music = GetComponent(); 29 | } 30 | } 31 | void Update() 32 | { 33 | if (Application.loadedLevelName == "ShootMoon2") 34 | { 35 | //music.Stop(); 36 | StartCoroutine("fadeSound"); 37 | 38 | AudioBegin = false; 39 | } 40 | } 41 | 42 | IEnumerator fadeSound() 43 | { 44 | while (music.volume > 0.01f) 45 | { 46 | music.volume -= Time.deltaTime / 3; 47 | yield return null; 48 | } 49 | music.volume = 0; 50 | music.Stop(); 51 | } 52 | 53 | IEnumerator fadeIn() 54 | { 55 | while (music.volume < 0.4f) 56 | { 57 | music.volume += Time.deltaTime / 3; 58 | yield return null; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Scripts/MusicManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6568b493981e4224dbe08576d31dfcb7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicMenace.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicMenace : MonoBehaviour 6 | { 7 | public AudioSource music; 8 | public AudioClip clip; 9 | static bool AudioBegin = false; 10 | 11 | void Awake() 12 | { 13 | if (!AudioBegin) 14 | { 15 | //music.Play(); 16 | StartCoroutine("fadeIn"); 17 | DontDestroyOnLoad(gameObject); 18 | AudioBegin = true; 19 | } 20 | if (music == null) 21 | { 22 | music = GetComponent(); 23 | } 24 | } 25 | void Update() 26 | { 27 | if (Application.loadedLevelName == "Moon14") 28 | { 29 | StartCoroutine("fadeSound"); 30 | 31 | AudioBegin = false; 32 | } 33 | } 34 | 35 | IEnumerator fadeSound() 36 | { 37 | while (music.volume > 0.01f) 38 | { 39 | music.volume -= Time.deltaTime / 8; 40 | yield return null; 41 | } 42 | music.volume = 0; 43 | music.Stop(); 44 | } 45 | 46 | IEnumerator fadeIn() 47 | { 48 | while (music.volume < 0.4f) 49 | { 50 | music.volume += Time.deltaTime / 3; 51 | yield return null; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Scripts/MusicMenace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da2edaf2c46f715449c82a633832b8b3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicMoon.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicMoon : MonoBehaviour 6 | { 7 | AudioSource music; 8 | 9 | static bool AudioBegin = false; 10 | 11 | void Start() 12 | { 13 | music = GetComponent(); 14 | } 15 | 16 | void Awake() 17 | { 18 | if (!AudioBegin) 19 | { 20 | //music.Play(); 21 | DontDestroyOnLoad(gameObject); 22 | AudioBegin = true; 23 | } 24 | } 25 | void Update() 26 | { 27 | if (Application.loadedLevelName == "Moon02") 28 | { 29 | //music.Stop(); 30 | StartCoroutine("fadeSound"); 31 | 32 | AudioBegin = false; 33 | } 34 | } 35 | 36 | IEnumerator fadeSound() 37 | { 38 | while (music.volume > 0.01f) 39 | { 40 | music.volume -= Time.deltaTime / 2; 41 | yield return null; 42 | } 43 | music.volume = 0; 44 | music.Stop(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Scripts/MusicMoon.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b183cdb2e8e06343b9f07af033ca98b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/MusicViolon.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MusicViolon : MonoBehaviour 6 | { 7 | public AudioSource music; 8 | public AudioClip clip; 9 | 10 | static bool AudioBegin = false; 11 | 12 | void Awake() 13 | { 14 | if (!AudioBegin) 15 | { 16 | //music.Play(); 17 | StartCoroutine("fadeIn"); 18 | DontDestroyOnLoad(gameObject); 19 | AudioBegin = true; 20 | } 21 | if (music == null) 22 | { 23 | music = GetComponent(); 24 | } 25 | } 26 | void Update() 27 | { 28 | if (Application.loadedLevelName == "Moon08") 29 | { 30 | //music.Stop(); 31 | StartCoroutine("fadeSound"); 32 | 33 | AudioBegin = false; 34 | } 35 | if (Application.loadedLevelName == "Moon12") 36 | { 37 | //music.Stop(); 38 | StartCoroutine("fadeSound"); 39 | 40 | AudioBegin = false; 41 | } 42 | } 43 | 44 | IEnumerator fadeSound() 45 | { 46 | while (music.volume > 0.01f) 47 | { 48 | music.volume -= Time.deltaTime / 3; 49 | yield return null; 50 | } 51 | music.volume = 0; 52 | music.Stop(); 53 | } 54 | 55 | IEnumerator fadeIn() 56 | { 57 | while (music.volume < 0.3f) 58 | { 59 | music.volume += Time.deltaTime / 3; 60 | yield return null; 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Scripts/MusicViolon.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b75c13033a137f44ca0eb98cb0c215b5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/PauseMenu.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.SceneManagement; 5 | 6 | public class PauseMenu : MonoBehaviour 7 | { 8 | [SerializeField] 9 | GameObject pause; 10 | // Start is called before the first frame update 11 | void Start() 12 | { 13 | pause.SetActive(false); 14 | } 15 | 16 | // Update is called once per frame 17 | void Update() 18 | { 19 | if (Input.GetButtonDown("Submit")) 20 | { 21 | pause.SetActive(true); 22 | } 23 | if (Input.GetButtonDown("Jump")) 24 | { 25 | print("test"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Scripts/PauseMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c633ac5151fb09841ad5cb42b310b7dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/PlaySoundCollider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class PlaySoundCollider : MonoBehaviour 6 | { 7 | public float timer; 8 | public AudioClip son; 9 | AudioSource audioSource; 10 | 11 | void Start() 12 | { 13 | audioSource = GetComponent(); 14 | } 15 | 16 | void OnCollisionEnter2D(Collision2D col) 17 | { 18 | audioSource.PlayOneShot(son, 0.7F); 19 | DontDestroyOnLoad(audioSource); 20 | StartCoroutine(coroutine()); 21 | } 22 | void OnTriggerEnter2D(Collider2D col) 23 | { 24 | audioSource.PlayOneShot(son, 0.7F); 25 | DontDestroyOnLoad(audioSource); 26 | StartCoroutine(coroutine()); 27 | } 28 | 29 | IEnumerator coroutine() 30 | { 31 | yield return new WaitForSeconds(timer); 32 | Destroy(gameObject); 33 | } 34 | } -------------------------------------------------------------------------------- /Scripts/PlaySoundCollider.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc731b08888dc8b429586298d1475b41 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/PlayerDisappear.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.SceneManagement; 5 | 6 | public class PlayerDisappear : MonoBehaviour 7 | { 8 | public GameObject vaisseau; 9 | private Animator anim; 10 | 11 | // Start is called before the first frame update 12 | void Start() 13 | { 14 | anim = vaisseau.GetComponent(); 15 | anim.enabled = false; 16 | } 17 | 18 | // Update is called once per frame 19 | void Update() 20 | { 21 | 22 | } 23 | void OnCollisionEnter2D(Collision2D collision) 24 | { 25 | if (collision.gameObject.tag == "Player") 26 | { 27 | collision.gameObject.transform.position = new Vector3(0, 30, 0); 28 | anim.enabled = true; 29 | StartCoroutine(coroutine()); 30 | } 31 | } 32 | IEnumerator coroutine() 33 | { 34 | yield return new WaitForSeconds(5.0f); 35 | SceneManager.LoadScene("ShootMoon", LoadSceneMode.Single); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Scripts/PlayerDisappear.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c2209885601d414596cfa34d547c56b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/SoundPatrol.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class SoundPatrol : MonoBehaviour 6 | { 7 | AudioSource marche; 8 | 9 | // Start is called before the first frame update 10 | void Start() 11 | { 12 | marche = GetComponent(); 13 | marche.volume = 0; 14 | } 15 | 16 | // Update is called once per frame 17 | void Update() 18 | { 19 | 20 | } 21 | 22 | public AudioSource AddAudio(bool loop, bool playAwake, float vol) 23 | { 24 | AudioSource newAudio = gameObject.AddComponent(); 25 | 26 | newAudio.loop = loop; 27 | newAudio.playOnAwake = playAwake; 28 | newAudio.volume = vol; 29 | return newAudio; 30 | } 31 | 32 | //sons 33 | void AudioMarchePlay() 34 | { 35 | marche.volume = 1; 36 | } 37 | void AudioMarcheStop() 38 | { 39 | marche.volume = 0; 40 | } 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Scripts/SoundPatrol.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 151f6f608ab67234893410c73b35b0f0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Scripts/SoundPlayer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class SoundPlayer : MonoBehaviour 6 | { 7 | AudioSource marche; 8 | 9 | public AudioClip sautclip; 10 | AudioSource saut; 11 | 12 | public AudioClip fallclip; 13 | AudioSource fall; 14 | 15 | public AudioClip champclip; 16 | AudioSource champ; 17 | 18 | public AudioClip atkclip; 19 | AudioSource atk; 20 | 21 | 22 | 23 | // Start is called before the first frame update 24 | void Start() 25 | { 26 | marche = GetComponent(); 27 | marche.volume = 0; 28 | 29 | saut = AddAudio(false, false, 0.4f); 30 | fall = AddAudio(false, false, 0.4f); 31 | champ = AddAudio(false, false, 0.4f); 32 | atk = AddAudio(false, false, 0.4f); 33 | } 34 | 35 | // Update is called once per frame 36 | void Update() 37 | { 38 | 39 | } 40 | 41 | public AudioSource AddAudio(bool loop, bool playAwake, float vol) 42 | { 43 | AudioSource newAudio = gameObject.AddComponent(); 44 | 45 | newAudio.loop = loop; 46 | newAudio.playOnAwake = playAwake; 47 | newAudio.volume = vol; 48 | return newAudio; 49 | } 50 | 51 | //sons 52 | void AudioMarchePlay() 53 | { 54 | StartCoroutine("fadeIn"); 55 | //marche.volume = 1; 56 | } 57 | void AudioMarcheStop() 58 | { 59 | StartCoroutine("fadeOut"); 60 | //marche.volume = 0; 61 | } 62 | void AudioSaut() 63 | { 64 | saut.clip = sautclip; 65 | saut.Play(); 66 | } 67 | void AudioFall() 68 | { 69 | fall.clip = fallclip; 70 | fall.Play(); 71 | } 72 | 73 | void AudioChamp() 74 | { 75 | champ.clip = champclip; 76 | champ.Play(); 77 | } 78 | void AudioAttack() 79 | { 80 | atk.clip = atkclip; 81 | atk.Play(); 82 | } 83 | 84 | IEnumerator fadeOut() 85 | { 86 | while (marche.volume > 0.01f) 87 | { 88 | marche.volume -= Time.deltaTime / 0.1f; 89 | yield return null; 90 | } 91 | marche.volume = 0; 92 | } 93 | 94 | IEnumerator fadeIn() 95 | { 96 | while (marche.volume < 1f) 97 | { 98 | marche.volume += Time.deltaTime / 0.1f; 99 | yield return null; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Scripts/SoundPlayer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 846595f3dfc00d045b84f585c3a2d221 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | --------------------------------------------------------------------------------