mirror of
https://github.com/ConjureETS/Labo_2_equ_2_a15.git
synced 2026-03-24 01:21:07 +00:00
Added health script
This commit is contained in:
parent
1a0318aaa0
commit
ab20f6aca9
34
Assets/Health.cs
Normal file
34
Assets/Health.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class Health : MonoBehaviour {
|
||||||
|
|
||||||
|
public int maxHP;
|
||||||
|
private int hp;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
hp = maxHP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int removeHP(int amount)
|
||||||
|
{
|
||||||
|
hp -= amount;
|
||||||
|
if (hp < 0)
|
||||||
|
hp = 0;
|
||||||
|
return hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int addHP(int amount)
|
||||||
|
{
|
||||||
|
hp += amount;
|
||||||
|
if (hp > maxHP)
|
||||||
|
hp = maxHP;
|
||||||
|
return hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHP()
|
||||||
|
{
|
||||||
|
return hp;
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Health.cs.meta
Normal file
12
Assets/Health.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 28110cf2b286c534c94e41ea7e145ef0
|
||||||
|
timeCreated: 1447704727
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -8,7 +8,6 @@ PlayerSettings:
|
|||||||
defaultScreenOrientation: 4
|
defaultScreenOrientation: 4
|
||||||
targetDevice: 2
|
targetDevice: 2
|
||||||
targetResolution: 0
|
targetResolution: 0
|
||||||
useOnDemandResources: 0
|
|
||||||
accelerometerFrequency: 60
|
accelerometerFrequency: 60
|
||||||
companyName: DefaultCompany
|
companyName: DefaultCompany
|
||||||
productName: Laboratoire_2_Equipe_2
|
productName: Laboratoire_2_Equipe_2
|
||||||
@ -29,7 +28,6 @@ PlayerSettings:
|
|||||||
androidShowActivityIndicatorOnLoading: -1
|
androidShowActivityIndicatorOnLoading: -1
|
||||||
iosAppInBackgroundBehavior: 0
|
iosAppInBackgroundBehavior: 0
|
||||||
displayResolutionDialog: 1
|
displayResolutionDialog: 1
|
||||||
iosAllowHTTPDownload: 1
|
|
||||||
allowedAutorotateToPortrait: 1
|
allowedAutorotateToPortrait: 1
|
||||||
allowedAutorotateToPortraitUpsideDown: 1
|
allowedAutorotateToPortraitUpsideDown: 1
|
||||||
allowedAutorotateToLandscapeRight: 1
|
allowedAutorotateToLandscapeRight: 1
|
||||||
@ -137,15 +135,6 @@ PlayerSettings:
|
|||||||
iOSLaunchScreenFillPct: 100
|
iOSLaunchScreenFillPct: 100
|
||||||
iOSLaunchScreenSize: 100
|
iOSLaunchScreenSize: 100
|
||||||
iOSLaunchScreenCustomXibPath:
|
iOSLaunchScreenCustomXibPath:
|
||||||
iOSLaunchScreeniPadType: 0
|
|
||||||
iOSLaunchScreeniPadImage: {fileID: 0}
|
|
||||||
iOSLaunchScreeniPadBackgroundColor:
|
|
||||||
serializedVersion: 2
|
|
||||||
rgba: 0
|
|
||||||
iOSLaunchScreeniPadFillPct: 100
|
|
||||||
iOSLaunchScreeniPadSize: 100
|
|
||||||
iOSLaunchScreeniPadCustomXibPath:
|
|
||||||
iOSDeviceRequirements: []
|
|
||||||
AndroidTargetDevice: 0
|
AndroidTargetDevice: 0
|
||||||
AndroidSplashScreenScale: 0
|
AndroidSplashScreenScale: 0
|
||||||
androidSplashScreen: {fileID: 0}
|
androidSplashScreen: {fileID: 0}
|
||||||
@ -235,8 +224,6 @@ PlayerSettings:
|
|||||||
ps4SdkOverride:
|
ps4SdkOverride:
|
||||||
ps4BGMPath:
|
ps4BGMPath:
|
||||||
ps4ShareFilePath:
|
ps4ShareFilePath:
|
||||||
ps4ShareOverlayImagePath:
|
|
||||||
ps4PrivacyGuardImagePath:
|
|
||||||
ps4NPtitleDatPath:
|
ps4NPtitleDatPath:
|
||||||
ps4RemotePlayKeyAssignment: -1
|
ps4RemotePlayKeyAssignment: -1
|
||||||
ps4RemotePlayKeyMappingDir:
|
ps4RemotePlayKeyMappingDir:
|
||||||
@ -258,7 +245,6 @@ PlayerSettings:
|
|||||||
ps4attribMoveSupport: 0
|
ps4attribMoveSupport: 0
|
||||||
ps4attrib3DSupport: 0
|
ps4attrib3DSupport: 0
|
||||||
ps4attribShareSupport: 0
|
ps4attribShareSupport: 0
|
||||||
ps4IncludedModules: []
|
|
||||||
monoEnv:
|
monoEnv:
|
||||||
psp2Splashimage: {fileID: 0}
|
psp2Splashimage: {fileID: 0}
|
||||||
psp2NPTrophyPackPath:
|
psp2NPTrophyPackPath:
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 5.2.1f1
|
m_EditorVersion: 5.2.0f3
|
||||||
m_StandardAssetsVersion: 0
|
m_StandardAssetsVersion: 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user