Enemy attack + patrolling + camera

This commit is contained in:
bread disco 2023-10-01 01:12:54 +02:00
parent 3c4dd3af78
commit 43b419b676
17 changed files with 2074 additions and 639 deletions

View file

@ -0,0 +1,205 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &320947375089636428
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 320947375089636424}
- component: {fileID: 320947375089636427}
- component: {fileID: 320947375089636426}
- component: {fileID: 320947375089636429}
m_Layer: 5
m_Name: UIComplete
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &320947375089636424
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320947375089636428}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 320947374043188236}
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: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &320947375089636427
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320947375089636428}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &320947375089636426
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320947375089636428}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
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: 0
--- !u!114 &320947375089636429
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320947375089636428}
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!1001 &4778530786730089552
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 320947375089636424}
m_Modifications:
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_SizeDelta.x
value: 100
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_SizeDelta.y
value: 100
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_AnchoredPosition.x
value: 64.390015
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_AnchoredPosition.y
value: -307.86
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318623, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
propertyPath: m_Name
value: HeartSpawner
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
--- !u!224 &320947374043188236 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
m_PrefabInstance: {fileID: 4778530786730089552}
m_PrefabAsset: {fileID: 0}

View file

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

File diff suppressed because it is too large Load diff

View file

@ -1707,111 +1707,8 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &239918066
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 239918070}
- component: {fileID: 239918069}
- component: {fileID: 239918068}
- component: {fileID: 239918067}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &239918067
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 239918066}
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!114 &239918068
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 239918066}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
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: 0
--- !u!223 &239918069
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 239918066}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &239918070
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 239918066}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1806323321}
- {fileID: 445907187}
- {fileID: 1223902130}
m_Father: {fileID: 0}
m_RootOrder: 5
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, y: 0}
--- !u!1 &301257673
GameObject:
m_ObjectHideFlags: 0
@ -2082,310 +1979,6 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!1001 &430428824
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: grid
value:
objectReference: {fileID: 1359661565}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: Tilemap
value:
objectReference: {fileID: 1359661565}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: tilemap
value:
objectReference: {fileID: 1359661565}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: EntityToSpawn
value:
objectReference: {fileID: 5603740947797344480, guid: b650f7033d7b89a36943a33d4fd8730f, type: 3}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: nbEntityInstances
value: 2
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.size
value: 5
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.size
value: 5
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[0].x
value: 0.58
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[0].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[1].x
value: 3.14
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[1].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[2].x
value: -2.54
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[2].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[3].x
value: -6.97
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[3].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[4].x
value: 6.84
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: SpawnPositions.Array.data[4].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[0].x
value: 0.58
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[0].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[1].x
value: 3.14
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[1].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[2].x
value: -2.54
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[2].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[3].x
value: -6.97
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[3].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[4].x
value: 6.84
objectReference: {fileID: 0}
- target: {fileID: 934744677166207459, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: spawnPositions.Array.data[4].y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 1261290536216742845, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_Name
value: CoinEntitySpawner
objectReference: {fileID: 0}
- target: {fileID: 4219850689256547812, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: coinCount
value:
objectReference: {fileID: 445907186}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalPosition.x
value: 6.84
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalPosition.y
value: 2.48
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6214812198674791343, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e8524a4699d5e0d378b5b994c0a36044, type: 3}
--- !u!1 &445907186
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 445907187}
- component: {fileID: 445907189}
- component: {fileID: 445907188}
m_Layer: 5
m_Name: CoinCount
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &445907187
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 445907186}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 239918070}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 184.70001, y: -36.619995}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &445907188
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 445907186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_text: 0
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: a035a7cb8abf3b7408fef0a176af3856, type: 2}
m_sharedMaterial: {fileID: 5739899068905773544, guid: a035a7cb8abf3b7408fef0a176af3856, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &445907189
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 445907186}
m_CullTransparentMesh: 1
--- !u!1 &519420028
GameObject:
m_ObjectHideFlags: 0
@ -2615,11 +2208,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!224 &1223902130 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
m_PrefabInstance: {fileID: 5054441214071509998}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1359661565
GameObject:
m_ObjectHideFlags: 0
@ -2667,7 +2255,7 @@ Transform:
- {fileID: 301257674}
- {fileID: 1413566643}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1413566642
GameObject:
@ -3123,141 +2711,6 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!1 &1806323320
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1806323321}
- component: {fileID: 1806323323}
- component: {fileID: 1806323322}
m_Layer: 5
m_Name: CoinCountText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1806323321
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1806323320}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 239918070}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 99.4, y: -42.6}
m_SizeDelta: {x: 170.01404, y: 51.998993}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1806323322
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1806323320}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_text: 'Coins:'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: a035a7cb8abf3b7408fef0a176af3856, type: 2}
m_sharedMaterial: {fileID: 5739899068905773544, guid: a035a7cb8abf3b7408fef0a176af3856, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 25
m_fontSizeBase: 25
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1806323323
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1806323320}
m_CullTransparentMesh: 1
--- !u!1 &1934325932
GameObject:
m_ObjectHideFlags: 0
@ -3304,102 +2757,102 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &5054441214071509998
--- !u!1001 &320947374983942078
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 239918070}
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_Pivot.x
value: 0.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_Pivot.y
value: 0.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_RootOrder
value: 2
value: 4
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_AnchorMax.y
value: 0.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_AnchorMin.y
value: 0.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_SizeDelta.x
value: 100
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_SizeDelta.y
value: 100
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_AnchoredPosition.x
value: -335.61
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_AnchoredPosition.y
value: 83.14
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318620, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636424, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5054441214999318623, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
- target: {fileID: 320947375089636428, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}
propertyPath: m_Name
value: HeartSpawner
value: Canvas
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3ef18cbb089097c699e9db2bc9c87266, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 046a338bdf3a8fc38a9e0b956463a3ee, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1e68759655b4da56891fb8c5d0881fd6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class CameraFrame : MonoBehaviour
{
public Transform player;
public float speed;
// Update is called once per frame
void Update()
{
if (Vector2.Distance(transform.position, player.position) > 1f)
{
transform.position += Time.deltaTime * speed * Vector3.Normalize( new Vector3(player.transform.position.x,player.transform.position.y,0) - new Vector3(transform.position.x,transform.position.y,0));
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: da365dc4d3580bd85bd26228821befd5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TreeEditor;
using UnityEngine;
using UnityEngine.Events;
@ -10,17 +11,22 @@ public class EnemyAttack : MonoBehaviour
public delegate void HitByEnemyDelegate(Collider2D coll) ;
public HitByEnemyDelegate HitByEnemy ;
void Start()
private Collider2D _hitCollider;
private Collider2D _playerCollider;
private void Start()
{
_hitCollider = transform.GetComponent<Collider2D>();
_playerCollider = transform.parent.GetComponent<GreenEnemy>().player.GetComponent<Collider2D>();
}
private void OnTriggerStay2D(Collider2D coll)
private void Update()
{
if (coll.gameObject.CompareTag("Player"))
if (_hitCollider.bounds.Intersects(_playerCollider.bounds))
{
HitByEnemy?.Invoke(coll);
}
gameObject.SetActive(false);
HitByEnemy?.Invoke(_playerCollider);
gameObject.SetActive(false);
}
}
}

View file

@ -13,6 +13,7 @@ public class GreenEnemy : MonoBehaviour
private bool _isSprinting= false;
public float attackPhaseDuration;
public float attackDuration;
private float _currentSpeed;
@ -20,7 +21,7 @@ public class GreenEnemy : MonoBehaviour
private SpriteRenderer _attackPhaseIndicatorSpriteRenderer;
private bool _isAttacking = false;
public float hitForce;
private int _direction = 1;
// public float sight;
private BoxCollider2D _sightCollider;
@ -28,9 +29,13 @@ public class GreenEnemy : MonoBehaviour
private GameObject _attackRange;
public GameObject player;
private Rigidbody2D _playerRigidbody2D;
public int damage;
public Transform player;
private Heath _health;
// Start is called before the first frame update
void Start()
@ -49,7 +54,9 @@ public class GreenEnemy : MonoBehaviour
_attackRange = transform.Find("AttackRange").GameObject();
_attackRange.GetComponent<EnemyAttack>().HitByEnemy += OnHitByEnemy;
_sightCollider = transform.GetComponent<BoxCollider2D>();
// Health
_health = player.GetComponent<Heath>();
}
// Update is called once per frame
@ -58,7 +65,7 @@ public class GreenEnemy : MonoBehaviour
transform.position += Time.deltaTime*_currentSpeed*_direction*Vector3.right ;
}
void TurnAround()
public void TurnAround()
{
_direction *= -1;
transform.Rotate(Vector3.up, 180);
@ -76,14 +83,16 @@ public class GreenEnemy : MonoBehaviour
yield return new WaitForSeconds(attackPhaseDuration);
_attackPhaseIndicator.SetActive(false);
_attackRange.SetActive(true);
yield return new WaitForSeconds(attackDuration);
_attackRange.SetActive(false);
_currentSpeed = _isSprinting ? sprintSpeed : walkSpeed;
}
}
IEnumerator OnCollisionStay2D(Collision2D coll) {
// Changing direction
if (coll.gameObject.CompareTag("Wall") )
if (coll.gameObject.CompareTag("Wall"))
{
TurnAround();
@ -126,12 +135,11 @@ public class GreenEnemy : MonoBehaviour
}
}
}
public void OnHitByEnemy(Collider2D coll)
{
Debug.Log(coll.gameObject.tag);
// coll.gameObject.GetComponent<Rigidbody2D>()
// .AddForce(hitForce * _direction * Vector3.right, ForceMode2D.Impulse);
coll.gameObject.GetComponent<Rigidbody2D>()
.AddForce(hitForce * _direction * Vector3.right, ForceMode2D.Impulse);
_health.AlterHealth(-damage);
}
}

View file

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Heath : MonoBehaviour
{
public int initHealth;
private int _currentHealth;
public delegate void AlterHealthDelegate(int healthChange);
public AlterHealthDelegate AlterHealthEvent;
public delegate void DeathDelegate();
public DeathDelegate DeathEvent;
public void AlterHealth(int healthChange)
{
var newHealth = _currentHealth - healthChange;
if (newHealth <= 0)
{
DeathEvent?.Invoke();
return;
}
_currentHealth = newHealth;
AlterHealthEvent?.Invoke(healthChange);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 787572aac1f51ee2ab510f3e139fa403
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 200bfd43b1eeeefa68d409cc1725f91a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyWall : MonoBehaviour
{
void OnTriggerEnter2D(Collider2D coll)
{
if (coll.CompareTag("Ennemy") && !coll.isTrigger)
{
coll.transform.GetComponent<GreenEnemy>().TurnAround();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 01b39d470f404b573a7f61c6bd7504c4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -5,43 +5,43 @@ using UnityEngine;
public class HeartSpawner : MonoBehaviour
{
private float resetTime = 0.5f;
private float timer;
// private float timer;
private UIItemSpawner _uiItemSpawner;
public Transform player;
private Heath _playerHealth;
// Start is called before the first frame update
void Start()
{
timer = resetTime;
// timer = resetTime;
_uiItemSpawner = transform.GetComponent<UIItemSpawner>();
_playerHealth = player.GetComponent<Heath>();
_uiItemSpawner.initNbEntityInstances = _playerHealth.initHealth;
_playerHealth.AlterHealthEvent += OnAlterHealth;
}
// Update is called once per frame
void Update()
void OnAlterHealth(int healthChange)
{
if (timer > 0) {
timer -= Time.deltaTime;
if (healthChange < 0)
{
healthChange = -healthChange;
for (int k = 0; k < healthChange; k++)
{
_uiItemSpawner.DespawnEntity();
}
if (Input.GetKeyDown("[+]") && timer <= 0)
{
_uiItemSpawner.SpawnEntity();
timer = resetTime;
}
if (Input.GetKeyDown("[-]") && timer <= 0)
else
{
_uiItemSpawner.DespawnEntity();
timer = resetTime;
for (int k = 0; k < healthChange; k++)
{
_uiItemSpawner.SpawnEntity();
}
}
if (Input.GetKeyDown("[*]") && timer <= 0)
{
_uiItemSpawner.SetAltItem(true);
timer = resetTime;
}
if (Input.GetKeyDown("[/]") && timer <= 0)
{
_uiItemSpawner.SetAltItem(false);
timer = resetTime;
}
}
}
// TODO void OnDeath()
}

View file

@ -48,7 +48,7 @@ public class UIItemSpawner : MonoBehaviour
if (index >= maxNbEntityInstances)
return;
var currentPos = gameObject.transform.position;
gameObject.transform.position = new Vector3(currentPos.x + gap, currentPos.y, currentPos.z);
transform.position = new Vector3(currentPos.x + gap, currentPos.y, currentPos.z);
_instances[index] = Instantiate(entityToSpawn, transform.parent, true);
_images[index] = _instances[index].GetComponent<Image>();
_instances[index].transform.position = currentPos;
@ -57,11 +57,10 @@ public class UIItemSpawner : MonoBehaviour
public void DespawnEntity()
{
Debug.Log(index);
if (index <= 0)
return;
var currentPos = gameObject.transform.position;
gameObject.transform.position = new Vector3(currentPos.x - gap, currentPos.y, currentPos.z); ;
transform.position = new Vector3(currentPos.x - gap, currentPos.y, currentPos.z); ;
index--;
Destroy(_instances[index]);
}
@ -85,7 +84,6 @@ public class UIItemSpawner : MonoBehaviour
{
var _spriteIndex = (m_IndexSprite + maxNbEntityInstances - currentIndex) % m_SpriteArray.Length;
Debug.Log(_spriteIndex);
_images[currentIndex].sprite = toggleAlt ? m_AltSpriteArray[_spriteIndex] : m_SpriteArray[_spriteIndex];
}

View file

@ -7,6 +7,7 @@ TagManager:
- Wall
- Ennemy
- Ground
- EnemyWall
layers:
- Default
- TransparentFX