diff --git a/Assets/Animation/AttackAnimation.anim b/Assets/Animation/AttackAnimation.anim index 523bd28..a248c50 100644 --- a/Assets/Animation/AttackAnimation.anim +++ b/Assets/Animation/AttackAnimation.anim @@ -30,16 +30,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 + time: 0.13333334 value: 1 inSlope: 0 outSlope: 0 @@ -57,16 +48,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.33333334 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 1 inSlope: 0 outSlope: 0 @@ -84,7 +66,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 1 inSlope: 0 outSlope: 0 @@ -93,7 +75,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 1 inSlope: 0 outSlope: 0 @@ -121,7 +121,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 + time: 0.13333334 value: 0.20983982 inSlope: 0 outSlope: 0 @@ -129,26 +129,8 @@ AnimationClip: weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - serializedVersion: 3 time: 0.25 - value: 0.20983982 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.33333334 value: 0 inSlope: 0 outSlope: 0 @@ -157,7 +139,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 0.20983982 inSlope: 0 outSlope: 0 @@ -175,7 +157,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 0.20983982 inSlope: 0 outSlope: 0 @@ -184,7 +166,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 0.20983982 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 0 inSlope: 0 outSlope: 0 @@ -212,16 +212,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 + time: 0.13333334 value: 0 inSlope: 0 outSlope: 0 @@ -239,16 +230,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.33333334 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 0 inSlope: 0 outSlope: 0 @@ -266,7 +248,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 0 inSlope: 0 outSlope: 0 @@ -275,7 +257,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 0 inSlope: 0 outSlope: 0 @@ -303,16 +303,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 + time: 0.13333334 value: 1 inSlope: 0 outSlope: 0 @@ -330,16 +321,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.33333334 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 1 inSlope: 0 outSlope: 0 @@ -357,7 +339,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 1 inSlope: 0 outSlope: 0 @@ -366,7 +348,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 1 inSlope: 0 outSlope: 0 @@ -423,7 +423,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.6666667 + m_StopTime: 1 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -452,16 +452,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 + time: 0.13333334 value: 1 inSlope: 0 outSlope: 0 @@ -479,16 +470,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.33333334 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 1 inSlope: 0 outSlope: 0 @@ -506,7 +488,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 1 inSlope: 0 outSlope: 0 @@ -515,7 +497,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 1 inSlope: 0 outSlope: 0 @@ -543,7 +543,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 + time: 0.13333334 value: 0.20983982 inSlope: 0 outSlope: 0 @@ -551,26 +551,8 @@ AnimationClip: weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - serializedVersion: 3 time: 0.25 - value: 0.20983982 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.33333334 value: 0 inSlope: 0 outSlope: 0 @@ -579,7 +561,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 0.20983982 inSlope: 0 outSlope: 0 @@ -597,7 +579,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 0.20983982 inSlope: 0 outSlope: 0 @@ -606,7 +588,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 0.20983982 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 0 inSlope: 0 outSlope: 0 @@ -634,16 +634,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 + time: 0.13333334 value: 0 inSlope: 0 outSlope: 0 @@ -661,16 +652,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.33333334 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 0 inSlope: 0 outSlope: 0 @@ -688,7 +670,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 0 inSlope: 0 outSlope: 0 @@ -697,7 +679,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 0 inSlope: 0 outSlope: 0 @@ -725,16 +725,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.083333336 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.16666667 + time: 0.13333334 value: 1 inSlope: 0 outSlope: 0 @@ -752,16 +743,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.33333334 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.41666666 + time: 0.36666667 value: 1 inSlope: 0 outSlope: 0 @@ -779,7 +761,7 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.5833333 + time: 0.6333333 value: 1 inSlope: 0 outSlope: 0 @@ -788,7 +770,25 @@ AnimationClip: inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.6666667 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.8666667 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 value: 1 inSlope: 0 outSlope: 0 @@ -807,14 +807,14 @@ AnimationClip: m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 m_Events: - - time: 0.083333336 + - time: 0.5 functionName: AttackHitEvent data: objectReferenceParameter: {fileID: 0} floatParameter: 0 intParameter: 0 messageOptions: 0 - - time: 0.41666666 + - time: 1 functionName: AttackHitEvent data: objectReferenceParameter: {fileID: 0} diff --git a/Assets/Enemies/Enemy.prefab b/Assets/Enemies/Enemy.prefab index f1ee00f..a038040 100644 --- a/Assets/Enemies/Enemy.prefab +++ b/Assets/Enemies/Enemy.prefab @@ -9,10 +9,10 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1834225747245264377} + - component: {fileID: 527013406} + - component: {fileID: 3924901601269037083} - component: {fileID: 3641925206354690580} - component: {fileID: 2032617874441210469} - - component: {fileID: 3924901601269037083} - - component: {fileID: 527013406} - component: {fileID: 527013401} - component: {fileID: 527013407} m_Layer: 0 @@ -38,6 +38,48 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} +--- !u!95 &527013406 +Animator: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1314956764262545219} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 9adb9a2d73196d648a28555e7ef55736, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!195 &3924901601269037083 +NavMeshAgent: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1314956764262545219} + m_Enabled: 1 + m_AgentTypeID: 0 + m_Radius: 0.4 + m_Speed: 3 + m_Acceleration: 8 + avoidancePriority: 50 + m_AngularSpeed: 140 + m_StoppingDistance: 0.2 + m_AutoTraverseOffMeshLink: 1 + m_AutoBraking: 1 + m_AutoRepath: 1 + m_Height: 1.45 + m_BaseOffset: 1 + m_WalkableMask: 4294967295 + m_ObstacleAvoidanceType: 4 --- !u!65 &3641925206354690580 BoxCollider: m_ObjectHideFlags: 0 @@ -64,52 +106,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _detectRange: 15 - _attackRange: 5 + _attackRange: 2 _rotationSpeed: 0.9 _target: {fileID: 0} _isProvoked: 0 ---- !u!195 &3924901601269037083 -NavMeshAgent: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1314956764262545219} - m_Enabled: 1 - m_AgentTypeID: 0 - m_Radius: 0.4 - m_Speed: 2 - m_Acceleration: 8 - avoidancePriority: 50 - m_AngularSpeed: 120 - m_StoppingDistance: 0.2 - m_AutoTraverseOffMeshLink: 1 - m_AutoBraking: 1 - m_AutoRepath: 1 - m_Height: 1.45 - m_BaseOffset: 1 - m_WalkableMask: 4294967295 - m_ObstacleAvoidanceType: 4 ---- !u!95 &527013406 -Animator: - serializedVersion: 4 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1314956764262545219} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: 9adb9a2d73196d648a28555e7ef55736, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_StabilizeFeet: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 --- !u!114 &527013401 MonoBehaviour: m_ObjectHideFlags: 0 @@ -136,8 +136,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d9ce02b60179d0340bac9f018033afab, type: 3} m_Name: m_EditorClassIdentifier: - target: {fileID: 0} - damage: 40 + _target: {fileID: 0} + _damage: 25 --- !u!1 &8248657945561792745 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Enemies/EnemyAI.cs b/Assets/Enemies/EnemyAI.cs index f05679a..eafb89b 100644 --- a/Assets/Enemies/EnemyAI.cs +++ b/Assets/Enemies/EnemyAI.cs @@ -1,7 +1,7 @@ using UnityEngine; using UnityEngine.AI; -public class EnemyAI : MonoBehaviour +public class EnemyAI : MonoBehaviour, IAggroable { [Header("Configuration")] [SerializeField] private float _detectRange = 15f; diff --git a/Assets/Enemies/EnemyAttack.cs b/Assets/Enemies/EnemyAttack.cs index b9851e5..88b8881 100644 --- a/Assets/Enemies/EnemyAttack.cs +++ b/Assets/Enemies/EnemyAttack.cs @@ -14,7 +14,7 @@ public class EnemyAttack : MonoBehaviour private void AttackHitEvent() { if (_target == null) return; - if (_target.GetComponent() != null) return; + if (_target.GetComponent() == null) return; Debug.Log($"{transform.name} Hits {_target.transform.name}"); _target.GetComponent().ModifyHealth(-_damage); } diff --git a/Assets/Enemies/EnemyHealth.cs b/Assets/Enemies/EnemyHealth.cs index 9669bad..87ddfb2 100644 --- a/Assets/Enemies/EnemyHealth.cs +++ b/Assets/Enemies/EnemyHealth.cs @@ -12,16 +12,12 @@ public class EnemyHealth : MonoBehaviour, IDamageable _health = _maxHealth; } - private void Update() - { - if (!(_health <= 0)) return; - print("Ded"); - Destroy(gameObject); - } - public void ModifyHealth(float healthChange) { _health += healthChange; + if (!(_health <= 0)) return; + print("Ded"); + Destroy(gameObject); } public void SetHealth(float newHealth) diff --git a/Assets/ImportedAssets/StarterAssets/FirstPersonController/Prefabs/PlayerCapsule.prefab b/Assets/ImportedAssets/StarterAssets/FirstPersonController/Prefabs/PlayerCapsule.prefab index 4ca03dd..cb51c1d 100644 --- a/Assets/ImportedAssets/StarterAssets/FirstPersonController/Prefabs/PlayerCapsule.prefab +++ b/Assets/ImportedAssets/StarterAssets/FirstPersonController/Prefabs/PlayerCapsule.prefab @@ -197,6 +197,8 @@ GameObject: - component: {fileID: 1978471637655604388} - component: {fileID: 5420857361349278248} - component: {fileID: 8616685848737228376} + - component: {fileID: 8294200720936265358} + - component: {fileID: 8729095170121787993} m_Layer: 8 m_Name: PlayerCapsule m_TagString: Player @@ -251,9 +253,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 55919ac34a26952479f3fc91f777b2fa, type: 3} m_Name: m_EditorClassIdentifier: - MoveSpeed: 4 - SprintSpeed: 6 - RotationSpeed: 1 + MoveSpeed: 3.5 + SprintSpeed: 8 + RotationSpeed: 1.5 SpeedChangeRate: 10 JumpHeight: 1.2 Gravity: -15 @@ -297,13 +299,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e087ecce43ebbff45a1b360637807d93, type: 3} m_Name: m_EditorClassIdentifier: - move: {x: 0, y: 0} - look: {x: 0, y: 0} - jump: 0 - sprint: 0 - analogMovement: 0 - cursorLocked: 0 - cursorInputForLook: 1 + _move: {x: 0, y: 0} + _look: {x: 0, y: 0} + _jump: 0 + _sprint: 0 + _analogMovement: 0 + _cursorLocked: 1 + _cursorInputForLook: 1 --- !u!114 &8616685848737228376 MonoBehaviour: m_ObjectHideFlags: 0 @@ -402,6 +404,34 @@ MonoBehaviour: m_DefaultActionMap: Player m_SplitScreenIndex: -1 m_Camera: {fileID: 0} +--- !u!114 &8294200720936265358 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8616685848737228372} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c9b54b89b900ca46acb801d273ce670, type: 3} + m_Name: + m_EditorClassIdentifier: + _gameOverCanvas: {fileID: 0} +--- !u!114 &8729095170121787993 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8616685848737228372} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cd8f816ece356744ab73c6998c96717b, type: 3} + m_Name: + m_EditorClassIdentifier: + _deathHandler: {fileID: 8294200720936265358} + _maxHealth: 100 + _health: 0 --- !u!1001 &1216783236557002590 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/InputSystem/StarterAssetsInputs.cs b/Assets/InputSystem/StarterAssetsInputs.cs index e6a18e9..7c5fe51 100644 --- a/Assets/InputSystem/StarterAssetsInputs.cs +++ b/Assets/InputSystem/StarterAssetsInputs.cs @@ -30,7 +30,14 @@ namespace StarterAssets { if (_cursorInputForLook) { - LookInput(value.Get()); + if (Time.timeScale > 0) + { + LookInput(value.Get()); + } + else + { + LookInput(Vector2.zero); + } } } diff --git a/Assets/Interfaces.meta b/Assets/Interfaces.meta new file mode 100644 index 0000000..ef73d90 --- /dev/null +++ b/Assets/Interfaces.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 478e7d6acc302b64e969e23267aa1666 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Interfaces/IAggroable.cs b/Assets/Interfaces/IAggroable.cs new file mode 100644 index 0000000..00f202f --- /dev/null +++ b/Assets/Interfaces/IAggroable.cs @@ -0,0 +1,8 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +interface IAggroable +{ + public bool IsProvoked { get; set; } +} \ No newline at end of file diff --git a/Assets/Interfaces/IAggroable.cs.meta b/Assets/Interfaces/IAggroable.cs.meta new file mode 100644 index 0000000..6820e51 --- /dev/null +++ b/Assets/Interfaces/IAggroable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cac3261ff7d233544b303bd196756c1d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Enemies/IDamageable.cs b/Assets/Interfaces/IDamageable.cs similarity index 99% rename from Assets/Enemies/IDamageable.cs rename to Assets/Interfaces/IDamageable.cs index 5b48820..6ea95c6 100644 --- a/Assets/Enemies/IDamageable.cs +++ b/Assets/Interfaces/IDamageable.cs @@ -11,4 +11,4 @@ interface IDamageable public float GetMaxHealth(); public float GetHealthFactor(); -} +} \ No newline at end of file diff --git a/Assets/Enemies/IDamageable.cs.meta b/Assets/Interfaces/IDamageable.cs.meta similarity index 100% rename from Assets/Enemies/IDamageable.cs.meta rename to Assets/Interfaces/IDamageable.cs.meta diff --git a/Assets/PlayerHealth.cs b/Assets/PlayerHealth.cs index 7850cfb..d4ab457 100644 --- a/Assets/PlayerHealth.cs +++ b/Assets/PlayerHealth.cs @@ -2,6 +2,7 @@ using UnityEngine; public class PlayerHealth : MonoBehaviour, IDamageable { + [SerializeField] private DeathHandler _deathHandler; [SerializeField] private float _maxHealth; [SerializeField] private float _health; @@ -10,14 +11,6 @@ public class PlayerHealth : MonoBehaviour, IDamageable SetHealth(_maxHealth); } - private void Update() - { - if (_health <= 0) - { - Debug.Log($"{transform.name} Died"); - } - } - public float GetHealth() { return _health; @@ -33,9 +26,17 @@ public class PlayerHealth : MonoBehaviour, IDamageable return _maxHealth; } + public bool IsProvoked { get; set; } + public void ModifyHealth(float healthChange) { _health += healthChange; + + if (_health <= 0) + { + _health = 0; + _deathHandler.HandleDeath(); + } } public void SetHealth(float newHealth) diff --git a/Assets/Scenes/Sandbox.unity b/Assets/Scenes/Sandbox.unity index cdc04f0..598c50e 100644 --- a/Assets/Scenes/Sandbox.unity +++ b/Assets/Scenes/Sandbox.unity @@ -857,6 +857,80 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 520203987} m_CullTransparentMesh: 1 +--- !u!1001 &525282610 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2081327037} + m_Modifications: + - target: {fileID: 100000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_Name + value: CubePrototype04x04x04 (2) + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_RootOrder + value: 25 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalScale.z + value: 7.7161555 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalPosition.x + value: 27.25 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalPosition.y + value: -1.94 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalPosition.z + value: 7.2602 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.w + value: 0.98075604 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.x + value: 0.000000079892885 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.y + value: 0.000000015904144 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.z + value: 0.19523759 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 22.517 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 5d091c0f43a7704409e8d2eab7f99d8a, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} +--- !u!4 &525282611 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + m_PrefabInstance: {fileID: 525282610} + m_PrefabAsset: {fileID: 0} --- !u!4 &527013405 stripped Transform: m_CorrespondingSourceObject: {fileID: 1834225747245264377, guid: 3a896632310e02b468121bf09411f87e, type: 3} @@ -1540,6 +1614,84 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &815270658 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2081327037} + m_Modifications: + - target: {fileID: 100000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_Name + value: CubePrototype04x04x04 (3) + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_RootOrder + value: 26 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalScale.x + value: 3.2927983 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalScale.z + value: 0.7838 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalPosition.x + value: 1.87 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalPosition.y + value: -0.65 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalPosition.z + value: 28.87 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.w + value: 0.9419316 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.x + value: 0.00000007673013 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.y + value: 0.33580473 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalRotation.z + value: -0.00000002735478 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 39.243 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 2236c125e13c3dd41a4428d631bf633c, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} +--- !u!4 &815270659 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + m_PrefabInstance: {fileID: 815270658} + m_PrefabAsset: {fileID: 0} --- !u!1001 &868432015 PrefabInstance: m_ObjectHideFlags: 0 @@ -1736,6 +1888,84 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 880482538} m_CullTransparentMesh: 1 +--- !u!1001 &923022665 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2081327037} + m_Modifications: + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Name + value: BlockPrototype04x04x04 (2) + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_RootOrder + value: 22 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.x + value: 18.269152 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.y + value: 2.0733 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.x + value: 0.2542 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.y + value: -1.04 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.z + value: -32.2 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 1032d41f900276c40a9dd24f55b7d420, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} +--- !u!4 &923022666 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + m_PrefabInstance: {fileID: 923022665} + m_PrefabAsset: {fileID: 0} --- !u!1001 &945433442 PrefabInstance: m_ObjectHideFlags: 0 @@ -2610,7 +2840,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1400272403 RectTransform: m_ObjectHideFlags: 0 @@ -2681,7 +2911,7 @@ Canvas: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1400272402} - m_Enabled: 1 + m_Enabled: 0 serializedVersion: 3 m_RenderMode: 0 m_Camera: {fileID: 0} @@ -2832,6 +3062,10 @@ PrefabInstance: propertyPath: m_RootOrder value: 4 objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.y + value: 1.013 + objectReference: {fileID: 0} - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} propertyPath: m_LocalPosition.x value: 8.41873 @@ -3179,9 +3413,13 @@ PrefabInstance: propertyPath: m_RootOrder value: 5 objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} + propertyPath: m_LocalScale.x + value: 4.4709888 + objectReference: {fileID: 0} - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} propertyPath: m_LocalPosition.x - value: 20.428303 + value: 19.1793 objectReference: {fileID: 0} - target: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} propertyPath: m_LocalPosition.y @@ -3230,6 +3468,84 @@ Transform: m_CorrespondingSourceObject: {fileID: 400000, guid: 5d2e4237b4429b34fae4c9eb3cd9efd5, type: 3} m_PrefabInstance: {fileID: 1754370120} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1793928668 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2081327037} + m_Modifications: + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Name + value: BlockPrototype04x04x04 (1) + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_RootOrder + value: 21 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.x + value: 18.269152 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.y + value: 2.0851176 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.x + value: 0.2542 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.y + value: -1.04 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.z + value: 34.86 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 1032d41f900276c40a9dd24f55b7d420, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} +--- !u!4 &1793928669 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + m_PrefabInstance: {fileID: 1793928668} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1795367538 PrefabInstance: m_ObjectHideFlags: 0 @@ -3367,30 +3683,167 @@ Transform: m_CorrespondingSourceObject: {fileID: 8762286023885395322, guid: 9c489a8547f4d9e4387da15a4ff82c81, type: 3} m_PrefabInstance: {fileID: 6782772648210504087} m_PrefabAsset: {fileID: 0} ---- !u!1 &1859157918 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 8616685848737228372, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} - m_PrefabInstance: {fileID: 8204767108263278737} - m_PrefabAsset: {fileID: 0} ---- !u!114 &1859157924 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1859157918} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cd8f816ece356744ab73c6998c96717b, type: 3} - m_Name: - m_EditorClassIdentifier: - _maxHealth: 1000 - _health: 0 --- !u!20 &1874573760 stripped Camera: m_CorrespondingSourceObject: {fileID: 9005220659476430821, guid: 2d3a85ecde41a8246a79669975912b74, type: 3} m_PrefabInstance: {fileID: 4313866246714185760} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1957558930 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2081327037} + m_Modifications: + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Name + value: BlockPrototype04x04x04 (3) + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_RootOrder + value: 23 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.x + value: 18.269152 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.y + value: 2.0733 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.x + value: 32.8 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.y + value: -1.04 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.z + value: 0.3 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.y + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -90 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 1032d41f900276c40a9dd24f55b7d420, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} +--- !u!4 &1957558931 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + m_PrefabInstance: {fileID: 1957558930} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &1970649149 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2081327037} + m_Modifications: + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Name + value: BlockPrototype04x04x04 (4) + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_RootOrder + value: 24 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.x + value: 18.269152 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalScale.y + value: 2.0733 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.x + value: -34.55 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.y + value: -1.04 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalPosition.z + value: 0.3 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.y + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -90 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2300000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 1032d41f900276c40a9dd24f55b7d420, type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} +--- !u!4 &1970649150 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 400000, guid: ab33e6080ae416b4d899f39fa8951b98, type: 3} + m_PrefabInstance: {fileID: 1970649149} + m_PrefabAsset: {fileID: 0} --- !u!4 &2023513984 stripped Transform: m_CorrespondingSourceObject: {fileID: 1834225747245264377, guid: 3a896632310e02b468121bf09411f87e, type: 3} @@ -3450,6 +3903,12 @@ Transform: - {fileID: 1441195750} - {fileID: 1597297138} - {fileID: 760641180} + - {fileID: 1793928669} + - {fileID: 923022666} + - {fileID: 1957558931} + - {fileID: 1970649150} + - {fileID: 525282611} + - {fileID: 815270659} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3475,7 +3934,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1834225747245264377, guid: 3a896632310e02b468121bf09411f87e, type: 3} propertyPath: m_LocalPosition.x - value: -11.185878 + value: -42.2 objectReference: {fileID: 0} - target: {fileID: 1834225747245264377, guid: 3a896632310e02b468121bf09411f87e, type: 3} propertyPath: m_LocalPosition.y @@ -3483,7 +3942,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1834225747245264377, guid: 3a896632310e02b468121bf09411f87e, type: 3} propertyPath: m_LocalPosition.z - value: 12.498965 + value: 19.77 objectReference: {fileID: 0} - target: {fileID: 1834225747245264377, guid: 3a896632310e02b468121bf09411f87e, type: 3} propertyPath: m_LocalRotation.w @@ -3676,6 +4135,10 @@ PrefabInstance: propertyPath: reloadAction.m_Name value: Reload objectReference: {fileID: 0} + - target: {fileID: 1218087889432038952, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2132953286740742962, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} propertyPath: fireAction.m_Id value: 95062357-7b41-46da-81a2-d1977a9c523b @@ -3692,6 +4155,14 @@ PrefabInstance: propertyPath: reloadAction.m_Name value: Reload objectReference: {fileID: 0} + - target: {fileID: 3273242134651530650, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3360281265970703093, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4641286401744272850, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} propertyPath: _fpCamera value: @@ -3720,6 +4191,10 @@ PrefabInstance: propertyPath: reloadAction.m_Name value: Reload objectReference: {fileID: 0} + - target: {fileID: 8294200720936265358, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} + propertyPath: _gameOverCanvas + value: + objectReference: {fileID: 1400272406} - target: {fileID: 8616685848737228372, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} propertyPath: m_Name value: Player @@ -3732,10 +4207,6 @@ PrefabInstance: propertyPath: m_Camera value: objectReference: {fileID: 1874573760} - - target: {fileID: 8616685848737228376, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} - propertyPath: m_Actions - value: - objectReference: {fileID: -944628639613478452, guid: 4419d82f33d36e848b3ed5af4c8da37e, type: 3} - target: {fileID: 8616685848737228376, guid: c5efc39a8aaf6e64ea40e9ad573e9b47, type: 3} propertyPath: m_Enabled value: 1 diff --git a/Assets/Scenes/Sandbox/NavMesh.asset b/Assets/Scenes/Sandbox/NavMesh.asset index 677a389..050315c 100644 Binary files a/Assets/Scenes/Sandbox/NavMesh.asset and b/Assets/Scenes/Sandbox/NavMesh.asset differ diff --git a/Assets/Scripts/DeathHandler.cs b/Assets/Scripts/DeathHandler.cs new file mode 100644 index 0000000..484749c --- /dev/null +++ b/Assets/Scripts/DeathHandler.cs @@ -0,0 +1,32 @@ +using System; +using Unity.VisualScripting; +using UnityEngine; +using UnityEngine.InputSystem; + +public class DeathHandler : MonoBehaviour +{ + [SerializeField] private Canvas _gameOverCanvas; + + private void Start() + { + _gameOverCanvas.enabled = false; + Time.timeScale = 1; + } + + private void Update() + { + if (Keyboard.current.escapeKey.wasPressedThisFrame) + { + HandleDeath(); + } + } + + public void HandleDeath() + { + print("Player died"); + _gameOverCanvas.enabled = true; + Cursor.lockState = CursorLockMode.None; + Cursor.visible = true; + Time.timeScale = 0; + } +} \ No newline at end of file diff --git a/Assets/Scripts/DeathHandler.cs.meta b/Assets/Scripts/DeathHandler.cs.meta new file mode 100644 index 0000000..5028667 --- /dev/null +++ b/Assets/Scripts/DeathHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c9b54b89b900ca46acb801d273ce670 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Weapons/Weapon.cs b/Assets/Weapons/Weapon.cs index 7d508dc..f0e3cd1 100644 --- a/Assets/Weapons/Weapon.cs +++ b/Assets/Weapons/Weapon.cs @@ -52,9 +52,9 @@ public class Weapon : MonoBehaviour hit.transform.GetComponent().ModifyHealth(-_weaponDamage); } - if (hit.transform.GetComponent() != null) + if (hit.transform.GetComponent() != null) { - hit.transform.GetComponent().IsProvoked = true; + hit.transform.GetComponent().IsProvoked = true; } }