From c4d7294f8b509ff26d454bff7c5538308c1a6c77 Mon Sep 17 00:00:00 2001 From: farcy Date: Sun, 15 Nov 2020 19:23:38 +0100 Subject: [PATCH] son --- Assets/Scenes/Scene1.unity | 106 +++++++++++++++++++ Assets/Scenes/Scripts/Menu/DeathMenu.cs | 4 + Assets/Scenes/Scripts/SpaceShip/PV.cs | 4 +- Assets/Scenes/Scripts/Spawner/Spawner.cs | 4 +- Assets/Scripts/Food/TakeFood.cs | 5 +- Assets/Scripts/Monster/MonsterDeplacement.cs | 2 +- Assets/Scripts/Monster/MonsterFood.cs | 4 + 7 files changed, 124 insertions(+), 5 deletions(-) diff --git a/Assets/Scenes/Scene1.unity b/Assets/Scenes/Scene1.unity index 53f1c4f..17902c6 100644 --- a/Assets/Scenes/Scene1.unity +++ b/Assets/Scenes/Scene1.unity @@ -448,6 +448,102 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 4370738345167158660} m_PrefabAsset: {fileID: 0} +--- !u!82 &1697364593 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1697364587} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 218e454c50406fb4189f4f13471cf981, type: 3} + m_PlayOnAwake: 0 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!4 &1851246681 stripped Transform: m_CorrespondingSourceObject: {fileID: 3320924135295365722, guid: f08527ae00e09c847aebb171f1fa81b3, @@ -1106,6 +1202,16 @@ PrefabInstance: propertyPath: deathMenu value: objectReference: {fileID: 1697364587} + - target: {fileID: 5177300201713391517, guid: ef1080b9418e11948bc8a7c9402f7431, + type: 3} + propertyPath: m_audioClip + value: + objectReference: {fileID: 8300000, guid: 3242de36a8dcf3a499845bca958326b5, type: 3} + - target: {fileID: 5177300201713391517, guid: ef1080b9418e11948bc8a7c9402f7431, + type: 3} + propertyPath: m_PlayOnAwake + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7903293172621304627, guid: ef1080b9418e11948bc8a7c9402f7431, type: 3} propertyPath: m_Name diff --git a/Assets/Scenes/Scripts/Menu/DeathMenu.cs b/Assets/Scenes/Scripts/Menu/DeathMenu.cs index d33bb9b..cfe3a0b 100644 --- a/Assets/Scenes/Scripts/Menu/DeathMenu.cs +++ b/Assets/Scenes/Scripts/Menu/DeathMenu.cs @@ -8,9 +8,12 @@ public class DeathMenu : MonoBehaviour public bool on; // Start is called before the first frame update + + private AudioSource audio; void Start() { on = false; + audio = this.GetComponent(); } // Update is called once per frame @@ -24,6 +27,7 @@ void Update() if(on == true) { //FERMER L UI PRINCIPAL POUR LAISSER L UI DEATH + audio.Play(); } } diff --git a/Assets/Scenes/Scripts/SpaceShip/PV.cs b/Assets/Scenes/Scripts/SpaceShip/PV.cs index 017112b..74bfcee 100644 --- a/Assets/Scenes/Scripts/SpaceShip/PV.cs +++ b/Assets/Scenes/Scripts/SpaceShip/PV.cs @@ -10,10 +10,11 @@ public class PV : MonoBehaviour // DEATHMENU public GameObject deathMenu; - + private AudioSource audio; private void Start() { isDead = false; + audio = this.GetComponent(); } // Update is called once per frame void Update() @@ -27,6 +28,7 @@ private void OnCollisionEnter2D(Collision2D collision) { if(pv > 0) { + audio.Play(); pv = pv - 1; Destroy(collision.gameObject); } diff --git a/Assets/Scenes/Scripts/Spawner/Spawner.cs b/Assets/Scenes/Scripts/Spawner/Spawner.cs index 9d2530b..bd4bf38 100644 --- a/Assets/Scenes/Scripts/Spawner/Spawner.cs +++ b/Assets/Scenes/Scripts/Spawner/Spawner.cs @@ -23,9 +23,9 @@ void Update() Instantiate(gameObjectInstantiate[randEnemy], spawnPoint[randSpawnPoint].position, transform.rotation); difficultTimer = difficultTimer - 0.05f; timer = difficultTimer; - if(difficultTimer <=0.5f) + if(difficultTimer <=0.2f) { - difficultTimer = 0.5f; + difficultTimer = 0.2f; timer = difficultTimer; } } diff --git a/Assets/Scripts/Food/TakeFood.cs b/Assets/Scripts/Food/TakeFood.cs index e3e75dd..aafd9b6 100644 --- a/Assets/Scripts/Food/TakeFood.cs +++ b/Assets/Scripts/Food/TakeFood.cs @@ -6,9 +6,11 @@ public class TakeFood : MonoBehaviour { [SerializeField] LayerMask hitMask; + + private AudioSource audio; private void Start() { - + audio = this.GetComponent(); } private void OnCollisionEnter2D(Collision2D collision) { @@ -17,6 +19,7 @@ private void OnCollisionEnter2D(Collision2D collision) Food food; if (collision.transform.TryGetComponent(out food)) { + audio.Play(); FoodManager.Instance.AddFood(food); Destroy(collision.transform.gameObject); } diff --git a/Assets/Scripts/Monster/MonsterDeplacement.cs b/Assets/Scripts/Monster/MonsterDeplacement.cs index c506a97..7325063 100644 --- a/Assets/Scripts/Monster/MonsterDeplacement.cs +++ b/Assets/Scripts/Monster/MonsterDeplacement.cs @@ -45,7 +45,7 @@ void Update() } else if (targetFood) { - if(Vector2.Distance(transform.position,targetFood.position)< 5) + if(Vector2.Distance(transform.position,targetFood.position)< 10) { transform.position = Vector2.MoveTowards(transform.position, targetFood.position, speed * Time.deltaTime); Vector3 direction = targetFood.position - transform.position; diff --git a/Assets/Scripts/Monster/MonsterFood.cs b/Assets/Scripts/Monster/MonsterFood.cs index 909104c..68ba359 100644 --- a/Assets/Scripts/Monster/MonsterFood.cs +++ b/Assets/Scripts/Monster/MonsterFood.cs @@ -6,11 +6,14 @@ public class MonsterFood : MonoBehaviour { public MonsterDeplacement monsterState; public int monsterIntState; + + private AudioSource audio; // Start is called before the first frame update void Start() { monsterState =this.gameObject.GetComponent(); monsterIntState = monsterState.state; + audio = this.GetComponent(); } // Update is called once per frame @@ -23,6 +26,7 @@ private void OnCollisionEnter2D(Collision2D collision) { if(collision.gameObject.tag =="Food") { + audio.Play(); monsterIntState = monsterIntState + 1; monsterState.state = monsterIntState; Destroy(collision.gameObject);