diff --git a/Assets/CollisionCheck.cs b/Assets/Scripts/CollisionCheck.cs similarity index 75% rename from Assets/CollisionCheck.cs rename to Assets/Scripts/CollisionCheck.cs index e8b42a6..baa5842 100644 --- a/Assets/CollisionCheck.cs +++ b/Assets/Scripts/CollisionCheck.cs @@ -19,7 +19,10 @@ public class CollisionCheck : MonoBehaviour { health.text = "Health: " + gameObject.GetComponent().removeHP(1); } - + if(gameObject.GetComponent().getHP() == 0) + { + gameObject.GetComponent().Death(); + } } diff --git a/Assets/CollisionCheck.cs.meta b/Assets/Scripts/CollisionCheck.cs.meta similarity index 100% rename from Assets/CollisionCheck.cs.meta rename to Assets/Scripts/CollisionCheck.cs.meta diff --git a/Assets/Health.cs b/Assets/Scripts/Health.cs similarity index 100% rename from Assets/Health.cs rename to Assets/Scripts/Health.cs diff --git a/Assets/Health.cs.meta b/Assets/Scripts/Health.cs.meta similarity index 100% rename from Assets/Health.cs.meta rename to Assets/Scripts/Health.cs.meta diff --git a/Assets/Scripts/PlayerBehavior.cs b/Assets/Scripts/PlayerBehavior.cs index bcd5902..4b31553 100644 --- a/Assets/Scripts/PlayerBehavior.cs +++ b/Assets/Scripts/PlayerBehavior.cs @@ -74,4 +74,28 @@ public class PlayerBehavior : MonoBehaviour scale.x *= -1; transform.localScale = scale; } + + private void ResetGame() + { + Application.LoadLevel(Application.loadedLevelName); + Time.timeScale = 1f; + } + + public void Death() + { + StartCoroutine(ResetAfterSeconds(5)); + Time.timeScale = 0f; + } + + private IEnumerator ResetAfterSeconds(int seconds) + { + float pauseEndTime = Time.realtimeSinceStartup + seconds; + while (Time.realtimeSinceStartup < pauseEndTime) + { + yield return null; // Attend un frame + } + + // Reset and count deaths + ResetGame(); + } } diff --git a/Assets/RocketBehaviour.cs b/Assets/Scripts/RocketBehaviour.cs similarity index 100% rename from Assets/RocketBehaviour.cs rename to Assets/Scripts/RocketBehaviour.cs diff --git a/Assets/RocketBehaviour.cs.meta b/Assets/Scripts/RocketBehaviour.cs.meta similarity index 100% rename from Assets/RocketBehaviour.cs.meta rename to Assets/Scripts/RocketBehaviour.cs.meta diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 24b2ed9..f3abab5 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -8,7 +8,6 @@ PlayerSettings: defaultScreenOrientation: 4 targetDevice: 2 targetResolution: 0 - useOnDemandResources: 0 accelerometerFrequency: 60 companyName: DefaultCompany productName: Laboratoire_2_Equipe_2 @@ -29,7 +28,6 @@ PlayerSettings: androidShowActivityIndicatorOnLoading: -1 iosAppInBackgroundBehavior: 0 displayResolutionDialog: 1 - iosAllowHTTPDownload: 1 allowedAutorotateToPortrait: 1 allowedAutorotateToPortraitUpsideDown: 1 allowedAutorotateToLandscapeRight: 1 @@ -137,15 +135,6 @@ PlayerSettings: iOSLaunchScreenFillPct: 100 iOSLaunchScreenSize: 100 iOSLaunchScreenCustomXibPath: - iOSLaunchScreeniPadType: 0 - iOSLaunchScreeniPadImage: {fileID: 0} - iOSLaunchScreeniPadBackgroundColor: - serializedVersion: 2 - rgba: 0 - iOSLaunchScreeniPadFillPct: 100 - iOSLaunchScreeniPadSize: 100 - iOSLaunchScreeniPadCustomXibPath: - iOSDeviceRequirements: [] AndroidTargetDevice: 0 AndroidSplashScreenScale: 0 androidSplashScreen: {fileID: 0} @@ -235,8 +224,6 @@ PlayerSettings: ps4SdkOverride: ps4BGMPath: ps4ShareFilePath: - ps4ShareOverlayImagePath: - ps4PrivacyGuardImagePath: ps4NPtitleDatPath: ps4RemotePlayKeyAssignment: -1 ps4RemotePlayKeyMappingDir: @@ -258,7 +245,6 @@ PlayerSettings: ps4attribMoveSupport: 0 ps4attrib3DSupport: 0 ps4attribShareSupport: 0 - ps4IncludedModules: [] monoEnv: psp2Splashimage: {fileID: 0} psp2NPTrophyPackPath: diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 8a062e6..e040c5c 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 5.2.1f1 +m_EditorVersion: 5.2.0f3 m_StandardAssetsVersion: 0