Entities health bars

This commit is contained in:
Yann Dupont 01 2022-04-02 15:23:48 -04:00
parent 67fc4da188
commit 8da172f91a
8 changed files with 638 additions and 34 deletions

View File

@ -33,6 +33,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3324925360650734151}
- {fileID: 1378753994466832711}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -99,6 +100,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gameFlowManager: {fileID: 0}
<Health>k__BackingField: 0
healthBar: {fileID: 1378753993005748510}
bloodTokens: 1
<movementSpeed>k__BackingField: 0
<rotSpeed>k__BackingField: 0
@ -228,3 +230,124 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1001 &4195660105766504097
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 197677485360569565}
m_Modifications:
- target: {fileID: 2962150094107129826, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_Name
value: Health Bar Canvas
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_SizeDelta.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_SizeDelta.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150095172694672, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150095172694672, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
--- !u!224 &1378753994466832711 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
m_PrefabInstance: {fileID: 4195660105766504097}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1378753993005748510 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2962150095602046911, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
m_PrefabInstance: {fileID: 4195660105766504097}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aadb67b8f73573a44b31b015f38561ee, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -0,0 +1,354 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2962150094107129826
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2962150094107129830}
- component: {fileID: 2962150094107129825}
- component: {fileID: 2962150094107129824}
- component: {fileID: 2962150094107129827}
m_Layer: 5
m_Name: Health Bar Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2962150094107129830
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150094107129826}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2962150095602046910}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &2962150094107129825
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150094107129826}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &2962150094107129824
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150094107129826}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
--- !u!114 &2962150094107129827
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150094107129826}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1 &2962150094264397122
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2962150094264397123}
- component: {fileID: 2962150094264397121}
- component: {fileID: 2962150094264397120}
m_Layer: 5
m_Name: BG
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2962150094264397123
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150094264397122}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2962150095602046910}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2962150094264397121
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150094264397122}
m_CullTransparentMesh: 1
--- !u!114 &2962150094264397120
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150094264397122}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &2962150095172694675
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2962150095172694672}
- component: {fileID: 2962150095172694678}
- component: {fileID: 2962150095172694673}
m_Layer: 5
m_Name: Fill
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2962150095172694672
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150095172694675}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2962150095602046910}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2962150095172694678
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150095172694675}
m_CullTransparentMesh: 1
--- !u!114 &2962150095172694673
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150095172694675}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.6603774, g: 0.14017446, b: 0.14017446, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &2962150095602046905
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2962150095602046910}
- component: {fileID: 2962150095602046908}
- component: {fileID: 2962150095602046911}
m_Layer: 5
m_Name: Health Bar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2962150095602046910
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150095602046905}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3.1999998, y: 3.1999998, z: 3.1999998}
m_Children:
- {fileID: 2962150094264397123}
- {fileID: 2962150095172694672}
m_Father: {fileID: 2962150094107129830}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0.8}
m_SizeDelta: {x: 0.6, y: 0.1}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &2962150095602046908
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150095602046905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 0
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_FillRect: {fileID: 2962150095172694672}
m_HandleRect: {fileID: 0}
m_Direction: 0
m_MinValue: 0
m_MaxValue: 1
m_WholeNumbers: 0
m_Value: 1
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!114 &2962150095602046911
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2962150095602046905}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aadb67b8f73573a44b31b015f38561ee, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d1d8f8326b5490848a9400aa9bd6b2f4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -115,6 +115,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3597671410581014117}
- {fileID: 7668921808236339569}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -181,6 +182,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gameFlowManager: {fileID: 0}
<Health>k__BackingField: 0
healthBar: {fileID: 7668921808924868904}
bloodTokens: 1
<movementSpeed>k__BackingField: 0
<rotSpeed>k__BackingField: 0
@ -228,3 +230,124 @@ CircleCollider2D:
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.5
--- !u!1001 &4861301622389167767
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2399377275812995968}
m_Modifications:
- target: {fileID: 2962150094107129826, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_Name
value: Health Bar Canvas
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_SizeDelta.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_SizeDelta.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150095172694672, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2962150095172694672, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
--- !u!224 &7668921808236339569 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 2962150094107129830, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
m_PrefabInstance: {fileID: 4861301622389167767}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7668921808924868904 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2962150095602046911, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3}
m_PrefabInstance: {fileID: 4861301622389167767}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aadb67b8f73573a44b31b015f38561ee, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -51,6 +51,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 639be549366b46748bd86eb6cea796a3, type: 3}
m_Name:
m_EditorClassIdentifier:
gameFlowManager: {fileID: 0}
stats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
--- !u!114 &3126145803593047825
MonoBehaviour:
@ -64,13 +65,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3d475633c5bc498fac5a9e5ead64da55, type: 3}
m_Name:
m_EditorClassIdentifier:
gameFlowManager: {fileID: 0}
<Health>k__BackingField: 100
healthBar: {fileID: 0}
bloodTokens: 1
<movementSpeed>k__BackingField: 0
<rotSpeed>k__BackingField: 0
fov: 0
attackRange: 0
<attackDmg>k__BackingField: 0
attackCooldown: 0
target: {fileID: 0}
healthBar: {fileID: 0}
halo: {fileID: 0}
playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
--- !u!114 &1967503440015794769
MonoBehaviour:
m_ObjectHideFlags: 0
@ -100,6 +107,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
suckDuration: 1
suckRange: 3
healthGainFromSuck: 30
--- !u!212 &1214567908930553595
SpriteRenderer:
m_ObjectHideFlags: 0
@ -293,20 +301,16 @@ MonoBehaviour:
m_ActionId: d0405457-c534-4103-a0b6-cf113432b467
m_ActionName: Player/SwitchMinion[/Keyboard/q,/Keyboard/e,/XInputControllerWindows/leftShoulder,/XInputControllerWindows/rightShoulder]
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1967503440015794769}
m_TargetAssemblyTypeName: MinionThrower, Assembly-CSharp
m_MethodName: ToggleThrowMode
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: 6f870ff4-cc58-4173-855c-37192c5b63f5
m_Calls: []
m_ActionId: 01a06960-a379-49e3-9d58-9b7c8effcb3d
m_ActionName: Player/Start[/XInputControllerWindows/start,/Keyboard/enter]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 65aa4e67-f805-47b9-adc0-444ca0e0bec8
m_ActionName: Player/Accept[/XInputControllerWindows/buttonSouth,/XInputControllerWindows/start,/Keyboard/enter]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 5017bbb1-a56a-40c6-add6-2360873a6945
m_ActionName: Player/Throw[/Keyboard/r,/XInputControllerWindows/buttonNorth]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme:

View File

@ -626,26 +626,14 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1214567908930553595, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
propertyPath: m_SortingOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
propertyPath: healthBar
value:
objectReference: {fileID: 1464970062}
- target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
propertyPath: playerStats
value:
objectReference: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
- target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
propertyPath: gameFlowManager
value:
objectReference: {fileID: 1359990806}
- target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
propertyPath: <Health>k__BackingField
value: 100
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 7731321959366517533, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}

View File

@ -15,6 +15,7 @@ public class Entity : MonoBehaviour {
[field: SerializeField] public float Health { get; private set; }
[Min(10f)]
protected float initialHealth;
[SerializeField] [Required] protected HealthBar healthBar;
bool isAlive = true;
public int bloodTokens = 1;
[field: SerializeField] public float movementSpeed { get; private set; }
@ -81,6 +82,8 @@ public class Entity : MonoBehaviour {
//Apply damage to the entity, returns true if it is still alive
public virtual bool TakeDamage(float amount) {
Health -= amount;
healthBar.SetHealthFraction(Health / initialHealth);
if (Health <= 0) {
isAlive = false;
OnDied();
@ -91,6 +94,8 @@ public class Entity : MonoBehaviour {
public virtual void HealDamage(float amount) {
Health += amount;
healthBar.SetHealthFraction(Health / initialHealth);
if(Health > initialHealth) {
Health = initialHealth;
}

View File

@ -5,8 +5,8 @@ public class VampireEntity : Entity {
[SerializeField] [field: Required]
PlayerStats playerStats = null!;
[SerializeField] [Required]
HealthBar healthBar;
// [SerializeField] [Required]
// HealthBar healthBar;
protected override void Start() {
base.Start();
@ -22,12 +22,12 @@ public class VampireEntity : Entity {
TakeDamage(playerStats.bloodLossRate * Time.deltaTime);
}
public override bool TakeDamage(float amount) {
bool stillAlive = base.TakeDamage(amount);
healthBar.SetHealthFraction(Health / initialHealth);
// public override bool TakeDamage(float amount) {
// bool stillAlive = base.TakeDamage(amount);
// healthBar.SetHealthFraction(Health / initialHealth);
return stillAlive;
}
// return stillAlive;
// }
protected override void OnDied() => gameFlowManager.GameOver();
}