diff --git a/Assets/Prefabs/Enemy.prefab b/Assets/Prefabs/Enemy.prefab index a8d624b..cc99638 100644 --- a/Assets/Prefabs/Enemy.prefab +++ b/Assets/Prefabs/Enemy.prefab @@ -13,6 +13,7 @@ GameObject: - 61: {fileID: 6163544} - 114: {fileID: 11431192} - 95: {fileID: 9512508} + - 114: {fileID: 11482776} m_Layer: 0 m_Name: Enemy m_TagString: Enemy @@ -43,7 +44,7 @@ Rigidbody2D: m_LinearDrag: 0 m_AngularDrag: .0500000007 m_GravityScale: 1 - m_IsKinematic: 0 + m_IsKinematic: 1 m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 @@ -89,8 +90,19 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2995a96f18c88c3499b43774e78a5e9b, type: 3} m_Name: m_EditorClassIdentifier: - HP: 2 ground: {fileID: 0} +--- !u!114 &11482776 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 183722} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 28110cf2b286c534c94e41ea7e145ef0, type: 3} + m_Name: + m_EditorClassIdentifier: + maxHP: 2 --- !u!212 &21249000 SpriteRenderer: m_ObjectHideFlags: 1 @@ -132,6 +144,14 @@ Prefab: propertyPath: m_TagString value: Enemy objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_IsKinematic + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: maxHP + value: 2 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 183722} diff --git a/Assets/RocketBehaviour.cs b/Assets/RocketBehaviour.cs index 07c7215..75f6ace 100644 --- a/Assets/RocketBehaviour.cs +++ b/Assets/RocketBehaviour.cs @@ -24,7 +24,7 @@ public class RocketBehaviour : MonoBehaviour { // If it hits an enemy... if (collision.gameObject.tag == "Enemy") { // ... find the Enemy script and call the Hurt function. - collision.gameObject.GetComponent ().Hurt (); + collision.gameObject.GetComponent ().removeHP(1); // call the explosion animation Explode (); diff --git a/Assets/Scripts/EnemyBehavior.cs b/Assets/Scripts/EnemyBehavior.cs index e51c631..38f77f4 100644 --- a/Assets/Scripts/EnemyBehavior.cs +++ b/Assets/Scripts/EnemyBehavior.cs @@ -6,9 +6,9 @@ public class EnemyBehavior : MonoBehaviour { private float direction = 1.0f; private Rigidbody2D rb; private bool facingRight = true; - private bool dead = false; + private bool dead = false; - public int HP = 2; + private Health hp; // Ground @@ -20,6 +20,7 @@ public class EnemyBehavior : MonoBehaviour { rb = GetComponent(); groundBounds = ground.GetComponent().bounds; + hp = GetComponent(); } // Update is called once per frame @@ -34,7 +35,7 @@ public class EnemyBehavior : MonoBehaviour { flip(); // If the enemy has zero or fewer hit points and isn't dead yet... - if(HP <= 0 && !dead) + if(GetComponent().getHP() == 0 && !dead) // ... call the death function. Death (); @@ -48,12 +49,6 @@ public class EnemyBehavior : MonoBehaviour { transform.localScale = scale; } - public void Hurt() - { - // Reduce the number of hit points by one. - HP--; - } - void Death() { // Set dead to true. 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