Add melee enemy
This commit is contained in:
parent
9ed3d98e21
commit
2d7232ed0c
@ -120,6 +120,37 @@ NavMeshSettings:
|
|||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &61637923
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 61637924}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: AnimationRoot
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &61637924
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 61637923}
|
||||||
|
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: 490037238}
|
||||||
|
m_Father: {fileID: 895097236}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &162528936
|
--- !u!1 &162528936
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -154,7 +185,7 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 162528936}
|
m_GameObject: {fileID: 162528936}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 10bbd1a0d6cdfe747980a222ff5625b2, type: 3}
|
m_Script: {fileID: 11500000, guid: c119fe08cf5d2da43a8d58e6439195b3, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Follow: {fileID: 162528939}
|
Follow: {fileID: 162528939}
|
||||||
@ -187,6 +218,7 @@ MonoBehaviour:
|
|||||||
CurrentStatus:
|
CurrentStatus:
|
||||||
Target: {fileID: 0}
|
Target: {fileID: 0}
|
||||||
CloseEnoughRadius: 1
|
CloseEnoughRadius: 1
|
||||||
|
TargetPositionUpdateFrequency: 5
|
||||||
--- !u!114 &162528940
|
--- !u!114 &162528940
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1035,6 +1067,87 @@ Tilemap:
|
|||||||
m_ObjectToInstantiate: {fileID: 0}
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
m_TileFlags: 1
|
m_TileFlags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 1
|
||||||
|
- first: {x: -2, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 13
|
||||||
|
m_TileSpriteIndex: 13
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: -1, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 13
|
||||||
|
m_TileSpriteIndex: 13
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: 0, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 14
|
||||||
|
m_TileSpriteIndex: 14
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: 1, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 14
|
||||||
|
m_TileSpriteIndex: 14
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: 2, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 14
|
||||||
|
m_TileSpriteIndex: 14
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: 3, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 14
|
||||||
|
m_TileSpriteIndex: 14
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: 4, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 14
|
||||||
|
m_TileSpriteIndex: 14
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: 5, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 14
|
||||||
|
m_TileSpriteIndex: 14
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
|
- first: {x: 6, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
m_TileIndex: 14
|
||||||
|
m_TileSpriteIndex: 14
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 8
|
||||||
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
|
m_TileFlags: 1
|
||||||
|
m_ColliderType: 1
|
||||||
m_AnimatedTiles: {}
|
m_AnimatedTiles: {}
|
||||||
m_TileAssetArray:
|
m_TileAssetArray:
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
@ -1063,9 +1176,9 @@ Tilemap:
|
|||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 2
|
||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 11400000, guid: bafa49c09188b224cb96cc5219e71fe2, type: 2}
|
||||||
- m_RefCount: 6
|
- m_RefCount: 13
|
||||||
m_Data: {fileID: 11400000, guid: feb24d6900738d146ab6c5ecbb272804, type: 2}
|
m_Data: {fileID: 11400000, guid: feb24d6900738d146ab6c5ecbb272804, type: 2}
|
||||||
m_TileSpriteArray:
|
m_TileSpriteArray:
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
@ -1095,13 +1208,14 @@ Tilemap:
|
|||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 2
|
||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 8040196581939011165, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
- m_RefCount: 6
|
type: 3}
|
||||||
|
- m_RefCount: 13
|
||||||
m_Data: {fileID: -6936079216851816805, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
m_Data: {fileID: -6936079216851816805, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
type: 3}
|
type: 3}
|
||||||
m_TileMatrixArray:
|
m_TileMatrixArray:
|
||||||
- m_RefCount: 65
|
- m_RefCount: 74
|
||||||
m_Data:
|
m_Data:
|
||||||
e00: 1
|
e00: 1
|
||||||
e01: 0
|
e01: 0
|
||||||
@ -1136,7 +1250,7 @@ Tilemap:
|
|||||||
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
||||||
- m_RefCount: 65
|
- m_RefCount: 74
|
||||||
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_AnimationFrameRate: 1
|
m_AnimationFrameRate: 1
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
@ -1435,7 +1549,7 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 895097236}
|
m_Father: {fileID: 61637924}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &490037239
|
--- !u!212 &490037239
|
||||||
@ -1475,9 +1589,9 @@ SpriteRenderer:
|
|||||||
m_LightmapParameters: {fileID: 0}
|
m_LightmapParameters: {fileID: 0}
|
||||||
m_SortingLayerID: -947994997
|
m_SortingLayerID: -947994997
|
||||||
m_SortingLayer: 3
|
m_SortingLayer: 3
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 1
|
||||||
m_Sprite: {fileID: 21300000, guid: 472874229c563e241bddc073ec2dbb90, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 472874229c563e241bddc073ec2dbb90, type: 3}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 0.7873081, g: 1, b: 0.6839622, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
m_DrawMode: 0
|
m_DrawMode: 0
|
||||||
@ -1502,7 +1616,7 @@ GameObject:
|
|||||||
- component: {fileID: 628992545}
|
- component: {fileID: 628992545}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Walls
|
m_Name: Walls
|
||||||
m_TagString: Untagged
|
m_TagString: Environment
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
@ -1719,15 +1833,6 @@ Tilemap:
|
|||||||
m_TileFlags: 1
|
m_TileFlags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 1
|
||||||
- first: {x: 5, y: 0, z: 0}
|
- first: {x: 5, y: 0, z: 0}
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 6, y: 0, z: 0}
|
|
||||||
second:
|
second:
|
||||||
m_TileIndex: 14
|
m_TileIndex: 14
|
||||||
m_TileSpriteIndex: 14
|
m_TileSpriteIndex: 14
|
||||||
@ -1754,24 +1859,6 @@ Tilemap:
|
|||||||
m_ObjectToInstantiate: {fileID: 0}
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
m_TileFlags: 1
|
m_TileFlags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 1
|
||||||
- first: {x: -2, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 10
|
|
||||||
m_TileSpriteIndex: 10
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 6, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 13
|
|
||||||
m_TileSpriteIndex: 13
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: -6, y: 2, z: 0}
|
- first: {x: -6, y: 2, z: 0}
|
||||||
second:
|
second:
|
||||||
m_TileIndex: 9
|
m_TileIndex: 9
|
||||||
@ -1790,87 +1877,6 @@ Tilemap:
|
|||||||
m_ObjectToInstantiate: {fileID: 0}
|
m_ObjectToInstantiate: {fileID: 0}
|
||||||
m_TileFlags: 1
|
m_TileFlags: 1
|
||||||
m_ColliderType: 1
|
m_ColliderType: 1
|
||||||
- first: {x: -2, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 11
|
|
||||||
m_TileSpriteIndex: 11
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: -1, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 0, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 1, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 2, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 3, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 4, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 5, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 7
|
|
||||||
m_TileSpriteIndex: 7
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
- first: {x: 6, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
m_TileIndex: 14
|
|
||||||
m_TileSpriteIndex: 14
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 8
|
|
||||||
m_ObjectToInstantiate: {fileID: 0}
|
|
||||||
m_TileFlags: 1
|
|
||||||
m_ColliderType: 1
|
|
||||||
m_AnimatedTiles: {}
|
m_AnimatedTiles: {}
|
||||||
m_TileAssetArray:
|
m_TileAssetArray:
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
@ -1887,21 +1893,21 @@ Tilemap:
|
|||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 15
|
- m_RefCount: 7
|
||||||
m_Data: {fileID: 11400000, guid: 2004c99dc125dd542aafd24f4ad842f4, type: 2}
|
m_Data: {fileID: 11400000, guid: 2004c99dc125dd542aafd24f4ad842f4, type: 2}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 1
|
- m_RefCount: 1
|
||||||
m_Data: {fileID: 11400000, guid: d71c3f314fe54f141b9df7c5699b66ab, type: 2}
|
m_Data: {fileID: 11400000, guid: d71c3f314fe54f141b9df7c5699b66ab, type: 2}
|
||||||
- m_RefCount: 4
|
|
||||||
m_Data: {fileID: 11400000, guid: 3a266bd53dfebcf479f723737979e62d, type: 2}
|
|
||||||
- m_RefCount: 3
|
- m_RefCount: 3
|
||||||
|
m_Data: {fileID: 11400000, guid: 3a266bd53dfebcf479f723737979e62d, type: 2}
|
||||||
|
- m_RefCount: 2
|
||||||
m_Data: {fileID: 11400000, guid: bf9ccb7cbc24ca346944cfd6efb15bf6, type: 2}
|
m_Data: {fileID: 11400000, guid: bf9ccb7cbc24ca346944cfd6efb15bf6, type: 2}
|
||||||
- m_RefCount: 1
|
- m_RefCount: 1
|
||||||
m_Data: {fileID: 11400000, guid: b673d03227bc8f74eab4645216e9d2a4, type: 2}
|
m_Data: {fileID: 11400000, guid: b673d03227bc8f74eab4645216e9d2a4, type: 2}
|
||||||
- m_RefCount: 4
|
|
||||||
m_Data: {fileID: 11400000, guid: 607b380a0644eb9438d6f72c3c8434c5, type: 2}
|
|
||||||
- m_RefCount: 3
|
- m_RefCount: 3
|
||||||
|
m_Data: {fileID: 11400000, guid: 607b380a0644eb9438d6f72c3c8434c5, type: 2}
|
||||||
|
- m_RefCount: 2
|
||||||
m_Data: {fileID: 11400000, guid: 4bbf78a58bd67f246927f19ce84be3fd, type: 2}
|
m_Data: {fileID: 11400000, guid: 4bbf78a58bd67f246927f19ce84be3fd, type: 2}
|
||||||
m_TileSpriteArray:
|
m_TileSpriteArray:
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
@ -1918,7 +1924,7 @@ Tilemap:
|
|||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
m_Data: {fileID: 0}
|
m_Data: {fileID: 0}
|
||||||
- m_RefCount: 15
|
- m_RefCount: 7
|
||||||
m_Data: {fileID: 6408231970667830406, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
m_Data: {fileID: 6408231970667830406, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
type: 3}
|
type: 3}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
@ -1926,22 +1932,22 @@ Tilemap:
|
|||||||
- m_RefCount: 1
|
- m_RefCount: 1
|
||||||
m_Data: {fileID: 5441223297315994465, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
m_Data: {fileID: 5441223297315994465, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
type: 3}
|
type: 3}
|
||||||
- m_RefCount: 4
|
- m_RefCount: 3
|
||||||
m_Data: {fileID: -8025435653959805260, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
m_Data: {fileID: -8025435653959805260, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
type: 3}
|
type: 3}
|
||||||
- m_RefCount: 3
|
- m_RefCount: 2
|
||||||
m_Data: {fileID: -7869403223043187030, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
m_Data: {fileID: -7869403223043187030, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
type: 3}
|
type: 3}
|
||||||
- m_RefCount: 1
|
- m_RefCount: 1
|
||||||
m_Data: {fileID: -6108889420429456849, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
m_Data: {fileID: -6108889420429456849, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
type: 3}
|
type: 3}
|
||||||
- m_RefCount: 4
|
- m_RefCount: 3
|
||||||
m_Data: {fileID: -6315978382755026507, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
m_Data: {fileID: -6315978382755026507, guid: 3b5f43ce65db7e74f9d3a906dfc2c460,
|
||||||
type: 3}
|
type: 3}
|
||||||
- m_RefCount: 3
|
- m_RefCount: 2
|
||||||
m_Data: {fileID: 511961965738296472, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, type: 3}
|
m_Data: {fileID: 511961965738296472, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, type: 3}
|
||||||
m_TileMatrixArray:
|
m_TileMatrixArray:
|
||||||
- m_RefCount: 31
|
- m_RefCount: 19
|
||||||
m_Data:
|
m_Data:
|
||||||
e00: 1
|
e00: 1
|
||||||
e01: 0
|
e01: 0
|
||||||
@ -1976,7 +1982,7 @@ Tilemap:
|
|||||||
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
||||||
- m_RefCount: 0
|
- m_RefCount: 0
|
||||||
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
m_Data: {r: 0, g: 0, b: 0, a: 0}
|
||||||
- m_RefCount: 31
|
- m_RefCount: 19
|
||||||
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_AnimationFrameRate: 1
|
m_AnimationFrameRate: 1
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
@ -2149,7 +2155,7 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 867100008}
|
m_GameObject: {fileID: 867100008}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 10bbd1a0d6cdfe747980a222ff5625b2, type: 3}
|
m_Script: {fileID: 11500000, guid: c119fe08cf5d2da43a8d58e6439195b3, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Follow: {fileID: 867100016}
|
Follow: {fileID: 867100016}
|
||||||
@ -2182,6 +2188,7 @@ MonoBehaviour:
|
|||||||
CurrentStatus:
|
CurrentStatus:
|
||||||
Target: {fileID: 0}
|
Target: {fileID: 0}
|
||||||
CloseEnoughRadius: 1
|
CloseEnoughRadius: 1
|
||||||
|
TargetPositionUpdateFrequency: 5
|
||||||
--- !u!114 &867100017
|
--- !u!114 &867100017
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -2228,7 +2235,12 @@ GameObject:
|
|||||||
- component: {fileID: 895097240}
|
- component: {fileID: 895097240}
|
||||||
- component: {fileID: 895097239}
|
- component: {fileID: 895097239}
|
||||||
- component: {fileID: 895097238}
|
- component: {fileID: 895097238}
|
||||||
|
- component: {fileID: 895097244}
|
||||||
- component: {fileID: 895097237}
|
- component: {fileID: 895097237}
|
||||||
|
- component: {fileID: 895097243}
|
||||||
|
- component: {fileID: 895097241}
|
||||||
|
- component: {fileID: 895097242}
|
||||||
|
- component: {fileID: 895097245}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Enemy (Default Melee)
|
m_Name: Enemy (Default Melee)
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -2308,10 +2320,10 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 895097232}
|
m_GameObject: {fileID: 895097232}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -0.43, y: -2.53, z: 0}
|
m_LocalPosition: {x: -0.14, y: -1.57, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 490037238}
|
- {fileID: 61637924}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 6
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -2358,8 +2370,9 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: bbf2158cd27572e4599b4c813f555fd8, type: 3}
|
m_Script: {fileID: 11500000, guid: bbf2158cd27572e4599b4c813f555fd8, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Trigger: {fileID: 0}
|
Trigger: {fileID: 895097241}
|
||||||
TriggeredNodes: []
|
TriggeredNodes:
|
||||||
|
- {fileID: 895097244}
|
||||||
NotTriggeredNodes:
|
NotTriggeredNodes:
|
||||||
- {fileID: 895097238}
|
- {fileID: 895097238}
|
||||||
--- !u!114 &895097240
|
--- !u!114 &895097240
|
||||||
@ -2377,6 +2390,83 @@ MonoBehaviour:
|
|||||||
MoveSpeed: 1
|
MoveSpeed: 1
|
||||||
BehaviourTree: {fileID: 895097239}
|
BehaviourTree: {fileID: 895097239}
|
||||||
CurrentBehavior: Nothing
|
CurrentBehavior: Nothing
|
||||||
|
--- !u!114 &895097241
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 895097232}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 173be6658a5fcba49b9b1f1c91fa5f33, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Radius: 3
|
||||||
|
--- !u!114 &895097242
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 895097232}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f7e23822f429fcc46a8fd9163e68f332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
CurrentStatus:
|
||||||
|
Target: {fileID: 0}
|
||||||
|
CloseEnoughRadius: 1
|
||||||
|
TargetPositionUpdateFrequency: 2
|
||||||
|
--- !u!114 &895097243
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 895097232}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 6e805202a073c5541acd3aa2bde26513, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Follow: {fileID: 895097242}
|
||||||
|
PlayerSighted: {fileID: 895097241}
|
||||||
|
--- !u!114 &895097244
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 895097232}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 163f55033e69e2e4282c151e1a806bc6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Behaviours:
|
||||||
|
- {fileID: 895097245}
|
||||||
|
- {fileID: 895097242}
|
||||||
|
--- !u!114 &895097245
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 895097232}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3195d7385bc331f4296251042082af39, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
CurrentStatus:
|
||||||
|
Follow: {fileID: 895097242}
|
||||||
|
AnimatableTransform: {fileID: 61637924}
|
||||||
|
MeleeRange: 1.3
|
||||||
|
AttackAnimationLength: 0.1
|
||||||
|
ReleaseAnimationLength: 0.25
|
||||||
|
CooldownLength: 0.7
|
||||||
--- !u!1 &963194225
|
--- !u!1 &963194225
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -5,6 +5,8 @@ namespace Saltosion.OneWeapon.AI {
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class BehaviourBranch : BehaviourNode {
|
public class BehaviourBranch : BehaviourNode {
|
||||||
public Trigger Trigger;
|
public Trigger Trigger;
|
||||||
|
// FIXME: Change these from arrays to just single ones
|
||||||
|
// BehaviourLeaf already has the capability to have multiple behaviours
|
||||||
public BehaviourNode[] TriggeredNodes;
|
public BehaviourNode[] TriggeredNodes;
|
||||||
public BehaviourNode[] NotTriggeredNodes;
|
public BehaviourNode[] NotTriggeredNodes;
|
||||||
|
|
||||||
|
@ -4,16 +4,31 @@ namespace Saltosion.OneWeapon.AI.Behaviours {
|
|||||||
public class Follow : AIBehaviour {
|
public class Follow : AIBehaviour {
|
||||||
public Transform Target;
|
public Transform Target;
|
||||||
public float CloseEnoughRadius;
|
public float CloseEnoughRadius;
|
||||||
|
public float TargetPositionUpdateFrequency = 5f;
|
||||||
|
|
||||||
|
private Vector2 TargetPosition;
|
||||||
|
private float TargetPositionUpdateCooldown;
|
||||||
|
|
||||||
|
private void Update() {
|
||||||
|
|
||||||
|
if (Target != null && TargetPositionUpdateCooldown <= 0) {
|
||||||
|
TargetPositionUpdateCooldown = 1.0f / TargetPositionUpdateFrequency;
|
||||||
|
TargetPosition = Target.position;
|
||||||
|
} else if (Target == null) {
|
||||||
|
TargetPositionUpdateCooldown = 0.0f;
|
||||||
|
} else {
|
||||||
|
TargetPositionUpdateCooldown -= Time.deltaTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool CanBehave(Enemy subject) {
|
public override bool CanBehave(Enemy subject) {
|
||||||
return true;
|
return Target != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Execute(Enemy subject) {
|
public override bool Execute(Enemy subject) {
|
||||||
if (Target != null) {
|
if (Target != null) {
|
||||||
Vector2 position = subject.transform.position;
|
Vector2 position = subject.transform.position;
|
||||||
Vector2 targetPosition = Target.position;
|
Vector2 delta = TargetPosition - position;
|
||||||
Vector2 delta = targetPosition - position;
|
|
||||||
if (delta.magnitude > CloseEnoughRadius) {
|
if (delta.magnitude > CloseEnoughRadius) {
|
||||||
delta -= delta.normalized * CloseEnoughRadius;
|
delta -= delta.normalized * CloseEnoughRadius;
|
||||||
subject.StartMovingTo(position + delta);
|
subject.StartMovingTo(position + delta);
|
||||||
|
80
Assets/Scripts/AI/Behaviours/MeleeAttackFollowed.cs
Normal file
80
Assets/Scripts/AI/Behaviours/MeleeAttackFollowed.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Saltosion.OneWeapon.AI.Behaviours {
|
||||||
|
public class MeleeAttackFollowed : AIBehaviour {
|
||||||
|
public Follow Follow;
|
||||||
|
[Tooltip("This should be at 0,0,0 locally by default.")]
|
||||||
|
public Transform AnimatableTransform;
|
||||||
|
public float MeleeRange;
|
||||||
|
public float AttackAnimationLength;
|
||||||
|
public float ReleaseAnimationLength;
|
||||||
|
public float CooldownLength;
|
||||||
|
|
||||||
|
private bool AttackHit;
|
||||||
|
private float AnimationProgress;
|
||||||
|
private float CooldownProgress;
|
||||||
|
private Vector3 LocalOrigin;
|
||||||
|
|
||||||
|
private void Start() {
|
||||||
|
if (AnimatableTransform.localPosition.magnitude != 0) {
|
||||||
|
Debug.LogWarning($"{name} has an animated melee attack, and AnimatableTransform is not at local origin!");
|
||||||
|
}
|
||||||
|
LocalOrigin = AnimatableTransform.localPosition;
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Reset() {
|
||||||
|
AttackHit = false;
|
||||||
|
AnimationProgress = 0.0f;
|
||||||
|
CooldownProgress = 1.0f;
|
||||||
|
AnimatableTransform.localPosition = LocalOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update() {
|
||||||
|
if (CooldownProgress > 0) {
|
||||||
|
CurrentStatus = "Cooldown";
|
||||||
|
CooldownProgress -= Time.deltaTime / CooldownLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanBehave(Enemy subject) {
|
||||||
|
return Follow.Target != null && (Follow.Target.position - subject.transform.position).magnitude <= MeleeRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Execute(Enemy subject) {
|
||||||
|
if (CooldownProgress > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 Root = AnimatableTransform.parent.position + LocalOrigin;
|
||||||
|
Vector2 Target = Follow.Target.transform.position;
|
||||||
|
if (!AttackHit) {
|
||||||
|
CurrentStatus = "Hit";
|
||||||
|
AnimationProgress += Time.deltaTime / AttackAnimationLength;
|
||||||
|
AnimatableTransform.position = Vector2.Lerp(Root, Target, AnimationProgress);
|
||||||
|
if (AnimationProgress >= 1.0f) {
|
||||||
|
// Attack hit, deal damage and start return animation
|
||||||
|
AttackHit = true;
|
||||||
|
AnimationProgress = 0.0f;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CurrentStatus = "Retreat";
|
||||||
|
AnimationProgress += Time.deltaTime / ReleaseAnimationLength;
|
||||||
|
AnimatableTransform.position = Vector2.Lerp(Target, Root, AnimationProgress);
|
||||||
|
if (AnimationProgress >= 1.0f) {
|
||||||
|
// Attack finished, reset
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDrawGizmosSelected() {
|
||||||
|
Gizmos.color = Color.red;
|
||||||
|
Gizmos.DrawWireSphere(transform.position, MeleeRange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/AI/Behaviours/MeleeAttackFollowed.cs.meta
Normal file
11
Assets/Scripts/AI/Behaviours/MeleeAttackFollowed.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3195d7385bc331f4296251042082af39
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 10bbd1a0d6cdfe747980a222ff5625b2
|
guid: c119fe08cf5d2da43a8d58e6439195b3
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
18
Assets/Scripts/AI/PlayerFollower.cs
Normal file
18
Assets/Scripts/AI/PlayerFollower.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using Saltosion.OneWeapon.AI;
|
||||||
|
|
||||||
|
namespace Saltosion.OneWeapon {
|
||||||
|
[RequireComponent(typeof(AI.Behaviours.Follow), typeof(AI.Triggers.PlayerSighted))]
|
||||||
|
public class PlayerFollower : MonoBehaviour {
|
||||||
|
public AI.Behaviours.Follow Follow;
|
||||||
|
public AI.Triggers.PlayerSighted PlayerSighted;
|
||||||
|
|
||||||
|
private void Update() {
|
||||||
|
if (PlayerSighted.Player == null) {
|
||||||
|
Follow.Target = null;
|
||||||
|
} else {
|
||||||
|
Follow.Target = PlayerSighted.Player.transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/AI/PlayerFollower.cs.meta
Normal file
11
Assets/Scripts/AI/PlayerFollower.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6e805202a073c5541acd3aa2bde26513
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
13
Assets/Scripts/AI/Triggers/PlayerSighted.cs
Normal file
13
Assets/Scripts/AI/Triggers/PlayerSighted.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Saltosion.OneWeapon.AI.Triggers {
|
||||||
|
public class PlayerSighted : Trigger {
|
||||||
|
public float Radius;
|
||||||
|
public Player Player { get; private set; }
|
||||||
|
|
||||||
|
public override bool IsTriggered(Enemy subject) {
|
||||||
|
Player = Util.GetClosestTo<Player>(transform, Radius, true);
|
||||||
|
return Player != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/AI/Triggers/PlayerSighted.cs.meta
Normal file
11
Assets/Scripts/AI/Triggers/PlayerSighted.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 173be6658a5fcba49b9b1f1c91fa5f33
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -47,7 +47,7 @@ namespace Saltosion.OneWeapon.Bullets {
|
|||||||
Explodable Explodable = collider.GetComponent<Explodable>();
|
Explodable Explodable = collider.GetComponent<Explodable>();
|
||||||
if (Explodable != null) {
|
if (Explodable != null) {
|
||||||
Explodable.Explode(true);
|
Explodable.Explode(true);
|
||||||
} else {
|
} else if (collider.tag == "Environment") {
|
||||||
BloodLauncher.DebrisExplode(transform.position, Body.velocity.normalized * 0.7f, 5, 30f, 360);
|
BloodLauncher.DebrisExplode(transform.position, Body.velocity.normalized * 0.7f, 5, 30f, 360);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,35 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Saltosion.OneWeapon {
|
namespace Saltosion.OneWeapon {
|
||||||
public class Util {
|
public class Util {
|
||||||
public static T GetClosestTo<T>(Transform target, float radius) where T : MonoBehaviour {
|
public static T GetClosestTo<T>(Transform Searcher, float radius, bool needsLineOfSight = false) where T : MonoBehaviour {
|
||||||
Collider2D[] NearbyColliders = Physics2D.OverlapCircleAll(target.position, radius);
|
Collider2D[] NearbyColliders = Physics2D.OverlapCircleAll(Searcher.position, radius);
|
||||||
float LowestDistance = float.PositiveInfinity;
|
float LowestDistance = float.PositiveInfinity;
|
||||||
T FoundTarget = null;
|
T FoundTarget = null;
|
||||||
foreach (Collider2D Collider in NearbyColliders) {
|
foreach (Collider2D Collider in NearbyColliders) {
|
||||||
float Distance = (Collider.transform.position - target.position).magnitude;
|
if (Collider.gameObject == Searcher.gameObject) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 Delta = (Collider.transform.position - Searcher.position);
|
||||||
|
float Distance = Delta.magnitude;
|
||||||
T TargetComponent = Collider.GetComponent<T>();
|
T TargetComponent = Collider.GetComponent<T>();
|
||||||
if (TargetComponent != null && Distance < LowestDistance && Collider.gameObject != target.gameObject) {
|
RaycastHit2D[] Hits = Physics2D.RaycastAll(Searcher.position, Delta.normalized, Distance);
|
||||||
|
|
||||||
|
bool LineOfSightObstructed;
|
||||||
|
if (needsLineOfSight) {
|
||||||
|
LineOfSightObstructed = false;
|
||||||
|
foreach (RaycastHit2D Hit in Hits) {
|
||||||
|
if (Hit.collider != Collider && Hit.transform != Searcher) {
|
||||||
|
// Hit something between the target and the searcher
|
||||||
|
LineOfSightObstructed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LineOfSightObstructed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TargetComponent != null && !LineOfSightObstructed && Distance < LowestDistance) {
|
||||||
LowestDistance = Distance;
|
LowestDistance = Distance;
|
||||||
FoundTarget = TargetComponent;
|
FoundTarget = TargetComponent;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
--- !u!78 &1
|
--- !u!78 &1
|
||||||
TagManager:
|
TagManager:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
tags: []
|
tags:
|
||||||
|
- Environment
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
Loading…
Reference in New Issue
Block a user