MOD: Enemy AI

MOD: Player Shooting
MOD: Damage Player and Enemy
This commit is contained in:
Marvin Schneider 2024-09-05 20:40:50 +02:00
parent 4d0e81695d
commit 1eeafca3f2
36 changed files with 1072 additions and 508 deletions

View File

@ -1,5 +1,6 @@
fileFormatVersion: 2
guid: 5371915cc5465474db56c5d9b81541d0
guid: b4fb8444f942ec548902dab737d61a39
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:

View File

@ -0,0 +1,165 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5175427549288785024
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1617950343600548481}
- component: {fileID: 3995867185679161986}
- component: {fileID: 7512990218803126659}
- component: {fileID: 4554764900433820357}
- component: {fileID: -8580890670215362093}
m_Layer: 0
m_Name: Bullet
m_TagString: Bullet
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1617950343600548481
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175427549288785024}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.784, y: 0.002, z: 0}
m_LocalScale: {x: 0.3, y: 0.3, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &3995867185679161986
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175427549288785024}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &7512990218803126659
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175427549288785024}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 622784c880831334db51422cb3845e4a, type: 3}
m_Name:
m_EditorClassIdentifier:
force: 4
weapon: {fileID: 11400000, guid: d027aaa503179fb41b649c4133612883, type: 2}
--- !u!50 &4554764900433820357
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175427549288785024}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 1
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 0
--- !u!58 &-8580890670215362093
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5175427549288785024}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.49999997

View File

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

View File

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

View File

@ -0,0 +1,215 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2661868405439151674
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1823302128002486823}
- component: {fileID: 3154227569744544495}
m_Layer: 0
m_Name: EnemyModel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1823302128002486823
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2661868405439151674}
serializedVersion: 2
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: 893546842153150297}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &3154227569744544495
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2661868405439151674}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &6493647850785240687
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 893546842153150297}
- component: {fileID: 5626109799183272366}
- component: {fileID: 8635619511603780797}
- component: {fileID: 7924503280449502487}
- component: {fileID: 2426481138345412220}
m_Layer: 0
m_Name: EnemyMelee
m_TagString: Melee
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &893546842153150297
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6493647850785240687}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5.58, y: 3.49, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1823302128002486823}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!58 &5626109799183272366
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6493647850785240687}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.5
--- !u!50 &8635619511603780797
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6493647850785240687}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!114 &7924503280449502487
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6493647850785240687}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 60acc7aa2e862ff488845c60a00d73cc, type: 3}
m_Name:
m_EditorClassIdentifier:
enemy: {fileID: 11400000, guid: 63df9f54516b18345ac5c46505bb7091, type: 2}
health: 0
speed: 0
damage: 0
--- !u!114 &2426481138345412220
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6493647850785240687}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 52630bacc6c11024e9cbe915465fc6d0, type: 3}
m_Name:
m_EditorClassIdentifier:
player: {fileID: 0}
enemyStats: {fileID: 7924503280449502487}
targetDistance: 5

View File

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

View File

@ -12,9 +12,10 @@ GameObject:
- component: {fileID: 7831730424715986406}
- component: {fileID: 705292598182815017}
- component: {fileID: 788356621976524134}
- component: {fileID: 3625527783183967763}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -33,6 +34,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5584313292106778453}
- {fileID: 1341590168630826014}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!70 &7831730424715986406
@ -85,7 +87,7 @@ Rigidbody2D:
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_GravityScale: 0
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
@ -93,7 +95,7 @@ Rigidbody2D:
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_Interpolate: 1
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
@ -114,7 +116,159 @@ MonoBehaviour:
left: 97
right: 100
rb: {fileID: 705292598182815017}
speed: 20
playerStats: {fileID: 3625527783183967763}
speed: 5
--- !u!114 &3625527783183967763
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 381353064051161428}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b920576e7fca6774cac105ba69e65302, type: 3}
m_Name:
m_EditorClassIdentifier:
player: {fileID: 11400000, guid: 7c64b53d21912624bb32264372f5f097, type: 2}
weapon: {fileID: 11400000, guid: d027aaa503179fb41b649c4133612883, type: 2}
health: 0
speed: 0
damage: 0
fireRate: 0
--- !u!1 &2208842189449251999
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5183713849706516023}
- component: {fileID: 993297184508654982}
m_Layer: 0
m_Name: BulletTransform
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5183713849706516023
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2208842189449251999}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0.2588191, w: 0.9659258}
m_LocalPosition: {x: 1.2, y: 0, z: 0}
m_LocalScale: {x: 0.7, y: 0.7, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1341590168630826014}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 30}
--- !u!212 &993297184508654982
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2208842189449251999}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 75f5f34dc1b5347e0b8351032682f224, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &3210307820555334876
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1341590168630826014}
- component: {fileID: 1725852246881230115}
m_Layer: 0
m_Name: RotatePoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1341590168630826014
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3210307820555334876}
serializedVersion: 2
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:
- {fileID: 5183713849706516023}
m_Father: {fileID: 7799985602798067093}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1725852246881230115
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3210307820555334876}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d46013563bc18b149b0cc625199050ae, type: 3}
m_Name:
m_EditorClassIdentifier:
bulletPref: {fileID: 5175427549288785024, guid: f4c73891270d5e444ad7f38edd393bde, type: 3}
bulletTransform: {fileID: 5183713849706516023}
canFire: 1
playerStats: {fileID: 3625527783183967763}
--- !u!1 &3484942864972517972
GameObject:
m_ObjectHideFlags: 0

View File

@ -123,214 +123,11 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &67435261
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 67435262}
- component: {fileID: 67435263}
m_Layer: 0
m_Name: EnemyModel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &67435262
--- !u!4 &444734234 stripped
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_CorrespondingSourceObject: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
m_PrefabInstance: {fileID: 8284260373460371730}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 67435261}
serializedVersion: 2
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: 444734234}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &67435263
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 67435261}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: -2413806693520163455, guid: a86470a33a6bf42c4b3595704624658b, type: 3}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &444734229
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 444734234}
- component: {fileID: 444734233}
- component: {fileID: 444734232}
- component: {fileID: 444734231}
- component: {fileID: 444734230}
m_Layer: 0
m_Name: Enemy
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &444734230
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444734229}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 58a007a46183a8947a29e53b7c347d41, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &444734231
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444734229}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 60acc7aa2e862ff488845c60a00d73cc, type: 3}
m_Name:
m_EditorClassIdentifier:
enemy: {fileID: 11400000, guid: 63df9f54516b18345ac5c46505bb7091, type: 2}
health: 0
--- !u!50 &444734232
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444734229}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!58 &444734233
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444734229}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.5
--- !u!4 &444734234
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 444734229}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5.58, y: 3.49, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 67435262}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &780168302 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7799985602798067093, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
@ -540,6 +337,11 @@ MonoBehaviour:
m_CameraActivatedEvent:
m_PersistentCalls:
m_Calls: []
--- !u!1 &1227435621 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 381353064051161428, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
m_PrefabInstance: {fileID: 8392623100774979019}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1432196630
GameObject:
m_ObjectHideFlags: 0
@ -571,6 +373,7 @@ Transform:
m_Children:
- {fileID: 862008720}
- {fileID: 780168302}
- {fileID: 444734234}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2082218125
@ -726,6 +529,67 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e42508a65d73557449722d2ec88901c9, type: 3}
--- !u!1001 &8284260373460371730
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1432196631}
m_Modifications:
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalPosition.x
value: 5.58
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalPosition.y
value: 3.49
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 893546842153150297, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2426481138345412220, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: player
value:
objectReference: {fileID: 1227435621}
- target: {fileID: 6493647850785240687, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
propertyPath: m_Name
value: EnemyMelee
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3252080e9352bb84eb35d950674a2ef9, type: 3}
--- !u!1001 &8392623100774979019
PrefabInstance:
m_ObjectHideFlags: 0
@ -738,26 +602,6 @@ PrefabInstance:
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 705292598182815017, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
propertyPath: m_Mass
value: 1
objectReference: {fileID: 0}
- target: {fileID: 705292598182815017, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
propertyPath: m_GravityScale
value: 0
objectReference: {fileID: 0}
- target: {fileID: 788356621976524134, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
propertyPath: speed
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5584313292106778453, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5584313292106778453, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7799985602798067093, guid: f25706fcb77adb246a6a86fbe829a8f3, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -810,4 +654,3 @@ SceneRoots:
- {fileID: 1055048549}
- {fileID: 878561087}
- {fileID: 1432196631}
- {fileID: 444734234}

View File

@ -1,222 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &174343256
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 174343259}
- component: {fileID: 174343258}
- component: {fileID: 174343257}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &174343257
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 174343256}
m_Enabled: 1
--- !u!20 &174343258
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 174343256}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &174343259
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 174343256}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 174343259}

View File

@ -12,4 +12,5 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5821715bcd7665849b2215accab5515c, type: 3}
m_Name: CircleEnemy
m_EditorClassIdentifier:
health: 100
currentHealth: 100
currentSpeed: 2

View File

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

View File

@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f29fe535863e5b41bcdfc7b87840f04, type: 3}
m_Name: Player
m_EditorClassIdentifier:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7c64b53d21912624bb32264372f5f097
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c14c23aaaf8bbfd4d8320990568224eb, type: 3}
m_Name: Weapon1
m_EditorClassIdentifier:
damage: 20
fireRate: 0.1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d027aaa503179fb41b649c4133612883
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyMovement : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyMovementMelee : MonoBehaviour
{
public GameObject player;
public EnemyStats enemyStats;
public float targetDistance;
private float distance;
// Start is called before the first frame update
void Start()
{
enemyStats = GetComponent<EnemyStats>();
}
// Update is called once per frame
void Update()
{
if(player != null){
// Calculate the distance between the enemy and the player
distance = Vector2.Distance(transform.position, player.transform.position);
// Get the direction to the player by subtracting the enemy's position from the player's position
Vector2 direction = player.transform.position - transform.position;
direction.Normalize(); // Normalize the direction vector
// Calculate the angle to rotate the enemy to face the player
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
// If the player is within a certain range, move towards them
if (distance < targetDistance)
{
// Move the enemy towards the player's position
transform.position = Vector2.MoveTowards(transform.position, player.transform.position, enemyStats.speed * Time.deltaTime);
// Rotate the enemy to face the player
transform.rotation = Quaternion.Euler(Vector3.forward * angle);
}
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 58a007a46183a8947a29e53b7c347d41
guid: 52630bacc6c11024e9cbe915465fc6d0
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -8,16 +8,31 @@ public class EnemyStats : MonoBehaviour
public Enemy enemy;
public float health = 0;
public float speed = 0;
public float damage = 0;
private void Start() {
health = enemy.currentHealth;
speed = enemy.currentSpeed;
health = enemy.getCurrentHealth();
speed = enemy.getCurrentSpeed();
damage = enemy.getDamage();
}
//Für Später
/* private void OnCollisionEnter2D(Collision2D other) {
if (other.gameObject.CompareTag("Sword") || other.gameObject.CompareTag("Bullet")){
private void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.CompareTag("Bullet")){
BulletScript bulletScript = other.gameObject.GetComponent<BulletScript>();
health -= bulletScript.weapon.getDamage();
if (health <= 0)
{
Destroy(this.gameObject);
}
} else if(other.gameObject.CompareTag("Player")){
speed = 0f;
}
} */
}
private void OnTriggerExit2D(Collider2D other) {
speed = enemy.getCurrentSpeed();
}
}

View File

@ -12,12 +12,16 @@ public class PlayerMover : MonoBehaviour
public Rigidbody2D rb;
public PlayerStats playerStats;
public float speed = 2f;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
playerStats = GetComponent<PlayerStats>();
speed = playerStats.speed;
}
// Update is called once per frame
@ -26,27 +30,26 @@ public class PlayerMover : MonoBehaviour
Move();
}
public void Move(){
Vector2 moveDirection = Vector2.zero;
if(Input.GetKey(up)){
moveDirection += Vector2.up;
}
if(Input.GetKey(down)){
moveDirection += Vector2.down;
}
if(Input.GetKey(left)){
moveDirection += Vector2.left;
}
if(Input.GetKey(right)){
moveDirection += Vector2.right;
}
public void Move(){
Vector2 moveDirection = Vector2.zero;
if(moveDirection.magnitude > 1){
moveDirection.Normalize();
}
rb.velocity = moveDirection * speed * Time.deltaTime * 1000;
if(Input.GetKey(up)){
moveDirection += Vector2.up;
}
if(Input.GetKey(down)){
moveDirection += Vector2.down;
}
if(Input.GetKey(left)){
moveDirection += Vector2.left;
}
if(Input.GetKey(right)){
moveDirection += Vector2.right;
}
if(moveDirection.magnitude > 1){
moveDirection.Normalize(); // Normalize if diagonal to avoid faster movement
}
rb.velocity = moveDirection * speed;
}
}

View File

@ -0,0 +1,71 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerStats : MonoBehaviour
{
public Player player;
public Weapon weapon;
public float health = 0;
public float speed = 0;
public float damage = 0;
public float fireRate = 0;
private bool isTakingDamage = false;
// Start is called before the first frame update
void Start()
{
health = player.getCurrentHealth();
speed = player.getCurrentSpeed();
damage = weapon.getDamage();
fireRate = weapon.getFireRate();
}
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("Melee"))
{
if (!isTakingDamage)
{
StartCoroutine(TakeDamageOverTime(other.gameObject.GetComponent<EnemyStats>()));
}
if (health <= 0)
{
Destroy(this.gameObject);
}
}
}
private void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.CompareTag("Bullet") && !isTakingDamage){
BulletScript bulletScript = other.gameObject.GetComponent<BulletScript>();
health -= bulletScript.weapon.getDamage();
if (health <= 0)
{
Destroy(this.gameObject);
}
}
}
private void OnCollisionExit2D(Collision2D other)
{
if (other.gameObject.CompareTag("Melee"))
{
isTakingDamage = false;
}
}
private IEnumerator TakeDamageOverTime(EnemyStats enemyStats)
{
isTakingDamage = true;
while (isTakingDamage && enemyStats != null)
{
health -= enemyStats.damage;
yield return new WaitForSeconds(1f);
}
}
}

View File

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

View File

@ -0,0 +1,48 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shooting : MonoBehaviour
{
private Camera mainCam;
private Vector3 mousePos;
public GameObject bulletPref;
public Transform bulletTransform;
public bool canFire;
private float timer;
public PlayerStats playerStats;
// Start is called before the first frame update
void Start()
{
mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
playerStats = gameObject.GetComponentInParent<PlayerStats>();
}
// Update is called once per frame
void Update()
{
mousePos = mainCam.ScreenToWorldPoint(Input.mousePosition);
Vector3 rotation = mousePos - transform.position;
float rotZ = Mathf.Atan2(rotation.y, rotation.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0, 0, rotZ);
if(!canFire){
timer += Time.deltaTime;
if(timer > playerStats.fireRate){
canFire = true;
timer = 0;
}
}
if(Input.GetMouseButton(0) && canFire){
canFire = false;
Instantiate(bulletPref, bulletTransform.position, Quaternion.identity);
}
}
}

View File

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

View File

@ -5,14 +5,22 @@ using UnityEngine;
[CreateAssetMenu(fileName = "Enemy", menuName = "Enemy/Enemy", order = 0)]
public class Enemy : ScriptableObject
{
[HideInInspector]
public float currentHealth = 0;
[SerializeField]
private float health = 100;
public float currentSpeed = 0;
private float currentHealth = 100f;
[SerializeField]
private float currentSpeed = 2f;
[SerializeField]
private float damage = 20f;
private void Start() {
currentHealth = health;
public float getCurrentHealth(){
return currentHealth;
}
public float getCurrentSpeed(){
return currentSpeed;
}
public float getDamage(){
return damage;
}
}

View File

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

View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Player", menuName = "Player/Player", order = 0)]
public class Player : ScriptableObject
{
[SerializeField]
private float currentHealth = 100f;
[SerializeField]
private float currentSpeed = 5f;
public float getCurrentHealth(){
return currentHealth;
}
public float getCurrentSpeed(){
return currentSpeed;
}
}

View File

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

View File

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

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Weapon", menuName = "Weapon/Weapon", order = 0)]
public class Weapon : ScriptableObject
{
[SerializeField]
private float damage = 20f;
[SerializeField]
private float fireRate = 0;
public float getDamage(){
return damage;
}
public float getFireRate(){
return fireRate;
}
}

View File

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

View File

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

View File

@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletScript : MonoBehaviour
{
private Vector3 mousePos;
private Camera mainCamera;
private Rigidbody2D rb;
public float force;
public Weapon weapon;
// Start is called before the first frame update
void Start()
{
mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
rb = GetComponent<Rigidbody2D>();
mousePos = mainCamera.ScreenToWorldPoint(Input.mousePosition);
Vector3 direction = mousePos - transform.position;
Vector3 rotation = transform.position - mousePos;
rb.velocity = new Vector2(direction.x, direction.y).normalized * force;
float rot = Mathf.Atan2(rotation.y, rotation.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0, 0, rot + 90);
}
private void OnTriggerEnter2D(Collider2D other) {
Destroy(this.gameObject);
}
}

View File

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

View File

@ -3,7 +3,9 @@
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
tags:
- Melee
- Bullet
layers:
- Default
- TransparentFX