mirror of
https://github.com/ConjureETS/Labo_2_equ_2_a15.git
synced 2026-03-24 01:21:07 +00:00
Added death
This commit is contained in:
parent
77de950b72
commit
2348007017
@ -19,7 +19,10 @@ public class CollisionCheck : MonoBehaviour {
|
||||
health.text = "Health: " + gameObject.GetComponent<Health>().removeHP(1);
|
||||
}
|
||||
|
||||
|
||||
if(gameObject.GetComponent<Health>().getHP() == 0)
|
||||
{
|
||||
gameObject.GetComponent<PlayerBehavior>().Death();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 5.2.1f1
|
||||
m_EditorVersion: 5.2.0f3
|
||||
m_StandardAssetsVersion: 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user