This commit is contained in:
DyatelO 2022-01-08 15:06:29 +03:00
commit da02a25119
23 changed files with 601 additions and 287 deletions

View File

@ -12,7 +12,6 @@ GameObject:
- component: {fileID: 4155610655756139463}
- component: {fileID: 3748583951425988394}
- component: {fileID: 6763014501615571600}
- component: {fileID: 5390111712102929048}
m_Layer: 5
m_Name: AimCanvas
m_TagString: Untagged
@ -101,23 +100,6 @@ MonoBehaviour:
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &5390111712102929048
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2273039178377770117}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6650f022a8987a34e8da86d910b6e277, type: 3}
m_Name:
m_EditorClassIdentifier:
healthBar: {fileID: 0}
manaBar: {fileID: 0}
shotPrefab: {fileID: 9204531176590517796, guid: 74ba0f2e00eb74a4882dcf82bb66bb3f,
type: 3}
grid: {fileID: 0}
--- !u!1 &4408587040574959135
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,5 +1,81 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1713641455662992818
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2277933757415651690}
- component: {fileID: 2819458040482587629}
- component: {fileID: 3113562572513926796}
m_Layer: 5
m_Name: Capture
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2277933757415651690
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713641455662992818}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7490685757980339862}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2819458040482587629
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713641455662992818}
m_CullTransparentMesh: 1
--- !u!114 &3113562572513926796
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1713641455662992818}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.036904335, 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_Sprite: {fileID: -4039628871920856409, guid: bcfec907e0672ed45b69575096b4a1c2,
type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 1
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3185331048183402439
GameObject:
m_ObjectHideFlags: 0
@ -30,7 +106,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5156761560679623958}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -69,6 +145,83 @@ MonoBehaviour:
m_Spacing: {x: 0, y: 0}
m_Constraint: 0
m_ConstraintCount: 1
--- !u!1 &3936950508401920806
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7490685757980339862}
- component: {fileID: 5773971934982224891}
- component: {fileID: 5339304729368615127}
m_Layer: 5
m_Name: CaptureBack
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7490685757980339862
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3936950508401920806}
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: 2277933757415651690}
m_Father: {fileID: 5156761560679623958}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 1.77}
m_SizeDelta: {x: 3, y: 0.5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5773971934982224891
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3936950508401920806}
m_CullTransparentMesh: 1
--- !u!114 &5339304729368615127
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3936950508401920806}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -8254845973784877126, guid: bcfec907e0672ed45b69575096b4a1c2,
type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 1
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &4564225513960759228
GameObject:
m_ObjectHideFlags: 0
@ -177,8 +330,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children:
- {fileID: 6124438540769792862}
- {fileID: 5894909873554395549}
- {fileID: 7490685757980339862}
- {fileID: 7064199837503171822}
- {fileID: 82951532315249996}
m_Father: {fileID: 0}
@ -267,6 +420,7 @@ MonoBehaviour:
shotPrefab: {fileID: 9204531176590517796, guid: 74ba0f2e00eb74a4882dcf82bb66bb3f,
type: 3}
grid: {fileID: 3185331048183402439}
captureBar: {fileID: 3113562572513926796}
--- !u!1 &6201783996967795459
GameObject:
m_ObjectHideFlags: 0
@ -344,82 +498,6 @@ MonoBehaviour:
m_FillOrigin: 1
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &6720477436881757364
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6124438540769792862}
- component: {fileID: 3872739704401499897}
- component: {fileID: 3692302203462554896}
m_Layer: 5
m_Name: CaptureBar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &6124438540769792862
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6720477436881757364}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5156761560679623958}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 2}
m_SizeDelta: {x: 3, y: 0.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3872739704401499897
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6720477436881757364}
m_CullTransparentMesh: 1
--- !u!114 &3692302203462554896
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6720477436881757364}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 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_Sprite: {fileID: -2685135706508046216, guid: bcfec907e0672ed45b69575096b4a1c2,
type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 0
m_FillClockwise: 1
m_FillOrigin: 1
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7234977947494318781
GameObject:
m_ObjectHideFlags: 0

View File

@ -1691,7 +1691,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
barCanvas: {fileID: 268172662505640299}
aimCanvas: {fileID: 1011384888140022260}
captureBar: {fileID: 0}
captureBar: {fileID: 7165383102699947033}
--- !u!136 &1900872271281143359
CapsuleCollider:
m_ObjectHideFlags: 0
@ -3857,18 +3857,18 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
--- !u!224 &1904133429405396096 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 1261672157705434481}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1011384888140022260 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 1261672157705434481}
m_PrefabAsset: {fileID: 0}
--- !u!224 &1904133429405396096 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 1261672157705434481}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5786347879975309577
PrefabInstance:
m_ObjectHideFlags: 0
@ -4005,3 +4005,15 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 5786347879975309577}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7165383102699947033 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3692302203462554896, guid: dec5dd0d644d5c548a53563e65837162,
type: 3}
m_PrefabInstance: {fileID: 5786347879975309577}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -390,7 +390,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
barCanvas: {fileID: 9197595637317142914}
aimCanvas: {fileID: 8420239414472468003}
captureBar: {fileID: 0}
captureBar: {fileID: 2264286872868117744}
--- !u!136 &1571523103774403885
CapsuleCollider:
m_ObjectHideFlags: 0
@ -3858,18 +3858,30 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
--- !u!224 &7764648799730394358 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5156761560679623958, guid: dec5dd0d644d5c548a53563e65837162,
--- !u!114 &2264286872868117744 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3692302203462554896, guid: dec5dd0d644d5c548a53563e65837162,
type: 3}
m_PrefabInstance: {fileID: 3193594884886186464}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &9197595637317142914 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6049883652435591266, guid: dec5dd0d644d5c548a53563e65837162,
type: 3}
m_PrefabInstance: {fileID: 3193594884886186464}
m_PrefabAsset: {fileID: 0}
--- !u!224 &7764648799730394358 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5156761560679623958, guid: dec5dd0d644d5c548a53563e65837162,
type: 3}
m_PrefabInstance: {fileID: 3193594884886186464}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7193426573827869494
PrefabInstance:
m_ObjectHideFlags: 0
@ -4069,15 +4081,15 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
--- !u!1 &8420239414472468003 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 7733179963500614310}
m_PrefabAsset: {fileID: 0}
--- !u!224 &6971375767392389975 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 7733179963500614310}
m_PrefabAsset: {fileID: 0}
--- !u!1 &8420239414472468003 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 7733179963500614310}
m_PrefabAsset: {fileID: 0}

View File

@ -3517,7 +3517,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
barCanvas: {fileID: 8614863231585036848}
aimCanvas: {fileID: 8409302512724572423}
captureBar: {fileID: 0}
captureBar: {fileID: 1677050028044713794}
--- !u!136 &2198464067484123790
CapsuleCollider:
m_ObjectHideFlags: 0
@ -3933,6 +3933,18 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
--- !u!114 &1677050028044713794 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3692302203462554896, guid: dec5dd0d644d5c548a53563e65837162,
type: 3}
m_PrefabInstance: {fileID: 2628876604355308114}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &7200088151662806852 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5156761560679623958, guid: dec5dd0d644d5c548a53563e65837162,
@ -4069,15 +4081,15 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
--- !u!224 &6977806888759989363 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 7726115386004852098}
m_PrefabAsset: {fileID: 0}
--- !u!1 &8409302512724572423 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 7726115386004852098}
m_PrefabAsset: {fileID: 0}
--- !u!224 &6977806888759989363 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
type: 3}
m_PrefabInstance: {fileID: 7726115386004852098}
m_PrefabAsset: {fileID: 0}

View File

@ -19,3 +19,4 @@ MonoBehaviour:
type: 3}
inventoryView: {fileID: 1527356263590969195, guid: ff3bc3b17ddefd14eb798b22cf0a854f,
type: 3}
_add: {fileID: 7017227080055577099, guid: 1328a0e1e252d60408278772275bf560, type: 3}

View File

@ -215,7 +215,6 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1475618469}
- {fileID: 1787891160}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -453,54 +452,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1787891159
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1787891160}
- component: {fileID: 1787891161}
m_Layer: 5
m_Name: add
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1787891160
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1787891159}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 763084232}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1787891161
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1787891159}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a7c276b4af35fbc4a80539b97e444f32, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1854206697
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,6 +1,9 @@
using System;
using AI;
using Controller;
using Data;
using DG.Tweening;
using HexFiled;
using Runtime.Controller;
using Units;
using UnityEngine;
@ -11,13 +14,31 @@ namespace DefaultNamespace.AI
{
private Unit _enemy;
private Camera _camera;
public Action<AIAgent> OnAgentInited;
public Unit Enemy => _enemy;
public AIAgent(UnitInfo enemyInfo, Unit enemy)
{
_enemy = enemy;
_camera = Camera.main;
_enemy.OnDeath += AgentDeath;
}
private void AgentDeath()
{
AIManager.Instance.RemoveAgent(this);
}
public void InitAgent(GameObject unit)
{
HexManager.agents.Add(unit, this);
OnAgentInited?.Invoke(this);
}
public void Move(Vector2 direction)
{
_enemy.Move(DirectionHelper.VectorToDirection(direction));
}
public void FixedExecute()
{
//throw new System.NotImplementedException();

View File

@ -1,39 +1,136 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Controller;
using DefaultNamespace;
using DefaultNamespace.AI;
using HexFiled;
using Runtime.Controller;
using UnityEngine;
namespace AI
{
public class AIManager
public class AIManager : IFixedExecute
{
private List<AIAgent> _agents;
private int _triesToCalculatePath = 0;
private int _maxTriesToCalculatePath = 5;
private Dictionary<AIAgent, Queue<HexCell>> _pathToPatrol;
private static AIManager _instance;
public static AIManager Instance
{
get => _instance;
private set => _instance ??= value;
}
public AIManager(List<AIAgent> agents)
{
_agents = agents;
_pathToPatrol = new Dictionary<AIAgent, Queue<HexCell>>();
agents.ForEach(agent =>
{
_pathToPatrol.Add(agent, new Queue<HexCell>());
SetBehaviour(BotState.Patrol, agent);
});
}
public AIManager()
{
_agents = new List<AIAgent>();
_pathToPatrol = new Dictionary<AIAgent, Queue<HexCell>>();
Instance = this;
}
public void AddAgent(AIAgent agent)
{
_agents.Add(agent);
agent.OnAgentInited += InitAI;
}
public void RemoveAgent(AIAgent agent)
{
_agents.Remove(agent);
agent.OnAgentInited -= InitAI;
}
// private void SetBehaviour(BotState state)
// {
// //leftInput = Vector2.zero;
// switch (state)
// {
// case BotState.Patrol:
// MoveAlongPath();
// break;
// case BotState.Agressive:
// MoveToEnemy(_currentEnemy);
// break;
// case BotState.Attack:
// AttackEnemy(_currentEnemy);
// break;
// case BotState.CollectingBonus:
// MoveToBonus(_currentTargetTile);
// break;
// case BotState.ProtectBonusUsage:
// PlaceProtectBonus(_playerState.currentTile);
// break;
// }
// }
private void InitAI(AIAgent agent)
{
_pathToPatrol.Add(agent, new Queue<HexCell>());
SetBehaviour(BotState.Patrol, agent);
}
private void StartPatrolBehaviour(AIAgent agent)
{
HexManager.GetNearestDifferCell(agent.Enemy.Color, _pathToPatrol[agent]);
while (_pathToPatrol[agent] == null && _triesToCalculatePath < _maxTriesToCalculatePath)
{
HexManager.GetNearestDifferCell(agent.Enemy.Color, _pathToPatrol[agent]);
_triesToCalculatePath++;
}
MoveAlongPath(agent);
}
private void SetBehaviour(BotState state, AIAgent agent)
{
switch (state)
{
case BotState.Patrol:
MoveAlongPath(agent);
break;
case BotState.Agressive:
// MoveToEnemy(_currentEnemy);
break;
case BotState.Attack:
// AttackEnemy(_currentEnemy);
break;
case BotState.CollectingBonus:
// MoveToBonus(_currentTargetTile);
break;
case BotState.ProtectBonusUsage:
// PlaceProtectBonus(_playerState.currentTile);
break;
case BotState.AttackBonusUsage:
break;
case BotState.Dead:
break;
default:
throw new ArgumentOutOfRangeException(nameof(state), state, null);
}
}
private void MoveAlongPath(AIAgent agent)
{
//Debug.Log("try to move next point");
if (_pathToPatrol != null && _pathToPatrol[agent].Count > 0) //recalculate existing path or start anew one
{
var start = HexManager.UnitCurrentCell[agent.Enemy.Color].cell.transform.position;
var end = _pathToPatrol[agent].Dequeue().transform.position;
var dir = DirectionHelper.DirectionTo(start, end);
agent.Move(new Vector2(dir.x, dir.z));
}
else
{
StartPatrolBehaviour(agent);
}
}
public void FixedExecute()
{
for (int i = 0; i < _pathToPatrol.Count; i++)
{
if (!_agents[i].Enemy.IsBusy)
SetBehaviour(BotState.Patrol, _agents[i]);
}
}
}
public enum BotState
{
Patrol,

View File

@ -10,7 +10,7 @@
// {
// public bool isAIActive = true;
//
// public BotState botState = BotState.Patrol;
// public AIManager.BotState botState = AIManager.BotState.Patrol;
// public Vector2 leftInput, rightInput;
//
// public float agressiveTime = 5f;
@ -95,7 +95,7 @@
// Bonus chosenBonus;
// chosenBonus = _playerBonuses.attackBonuses[UnityEngine.Random.Range(0, _playerBonuses.attackBonuses.Count)];
//
// botState = BotState.AttackBonusUsage;
// botState = AIManager.BotState.AttackBonusUsage;
// isUseBonusEnabled = false;
// _actionTriggerSystem.TriggerAction(targetTile, chosenBonus.bonusAction);
// _currentBonus = chosenBonus;
@ -182,7 +182,7 @@
// }
// if (_currentFollowingPath!=null)
// {
// botState = BotState.Patrol;
// botState = AIManager.BotState.Patrol;
// _triesToCalculatePath = 0;
// }
//
@ -210,27 +210,27 @@
// private void CheckBotState()
// {
// //Debug.Log("CheckState");
// BotState newBotState;
// AIManager.BotState newBotState;
// if (CanPlaceProtectBonus())
// {
// newBotState = BotState.ProtectBonusUsage;
// newBotState = AIManager.BotState.ProtectBonusUsage;
// }
// else if (IsBonusDetected())
// {
// newBotState = BotState.CollectingBonus;
// newBotState = AIManager.BotState.CollectingBonus;
// //Debug.Log("CollectBonus");
// }
// else if (IsEnemyEnabledForAttack())
// {
// newBotState = BotState.Attack;
// newBotState = AIManager.BotState.Attack;
// }
// else if (IsEnemyCloseOrRude())
// {
// newBotState = BotState.Agressive;
// newBotState = AIManager.BotState.Agressive;
// }
// else
// {
// newBotState = BotState.Patrol;
// newBotState = AIManager.BotState.Patrol;
// }
//
// SetNewBotState(newBotState);
@ -240,7 +240,7 @@
// private bool CanPlaceProtectBonus()
// {
//
// if (botState == BotState.ProtectBonusUsage || botState == BotState.AttackBonusUsage)
// if (botState == AIManager.BotState.ProtectBonusUsage || botState == AIManager.BotState.AttackBonusUsage)
// {
// return false;
// }
@ -270,7 +270,7 @@
// private bool IsBonusDetected()
// {
// //Debug.Log("Detect bonus");
// if (botState == BotState.CollectingBonus)
// if (botState == AIManager.BotState.CollectingBonus)
// {
// return false;
// }
@ -292,7 +292,7 @@
// return false;
// }
//
// private bool SetNewBotState(BotState newState)
// private bool SetNewBotState(AIManager.BotState newState)
// {
// if (botState != newState)
// {
@ -309,7 +309,7 @@
// {
// if (isAttackedOnce)
// return false;
// if (botState != BotState.Attack && _attackEnergyController.IsReady())
// if (botState != AIManager.BotState.Attack && _attackEnergyController.IsReady())
// {
// foreach (PlayerState enemy in _playerState.enemies)
// {
@ -369,7 +369,7 @@
// {
// if (isAttackedOnce)
// return false;
// if (botState == BotState.Patrol && _attackEnergyController.IsReady())
// if (botState == AIManager.BotState.Patrol && _attackEnergyController.IsReady())
// {
// foreach (PlayerState enemy in _playerState.enemies)
// {
@ -400,24 +400,24 @@
// return false;
// }
//
// private void SetBehaviour(BotState state)
// private void SetBehaviour(AIManager.BotState state)
// {
// //leftInput = Vector2.zero;
// switch (state)
// {
// case BotState.Patrol:
// case AIManager.BotState.Patrol:
// MoveAlongPath();
// break;
// case BotState.Agressive:
// case AIManager.BotState.Agressive:
// MoveToEnemy(_currentEnemy);
// break;
// case BotState.Attack:
// case AIManager.BotState.Attack:
// AttackEnemy(_currentEnemy);
// break;
// case BotState.CollectingBonus:
// case AIManager.BotState.CollectingBonus:
// MoveToBonus(_currentTargetTile);
// break;
// case BotState.ProtectBonusUsage:
// case AIManager.BotState.ProtectBonusUsage:
// PlaceProtectBonus(_playerState.currentTile);
// break;
// }

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using HexFiled;
using UnityEngine;
@ -6,7 +7,7 @@ namespace AI
{
public static class Pathfinding
{
public static List<HexCell> FindPath(HexCell startTile, HexCell endTile, List<HexCell> allTiles)
public static Queue<HexCell> FindPath(HexCell startTile, HexCell endTile, List<HexCell> allTiles)
{
foreach (var tile in allTiles)
{
@ -89,17 +90,16 @@ namespace AI
// return adjacentNodes;
// }
private static List<HexCell> GetPathForNode(HexCell pathNode)
private static Queue<HexCell> GetPathForNode(HexCell pathNode)
{
var result = new List<HexCell>();
var result = new Queue<HexCell>();
var currentNode = pathNode;
while (currentNode != null)
{
result.Add(currentNode);
result.Enqueue(currentNode);
currentNode = currentNode.parent;
}
result.Reverse();
//Debug.Log("path found");
return result;
}

View File

@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Timers;
using AI;
using CamControl;
using Chars;
using DefaultNamespace;
using DefaultNamespace.AI;
using GameUI;
using HexFiled;
using Items;
@ -20,6 +22,9 @@ namespace Controller
public GameInit(Controllers controllers, Data.Data data)
{
HexManager.agents = new Dictionary<GameObject, AIAgent>();
AIManager aiManager = new AIManager();
controllers.Add(aiManager);
new GameObject("Timer").AddComponent<TimerHelper>();
var hexGrid = new HexGrid(data.FieldData);
@ -58,8 +63,14 @@ namespace Controller
var enemy = new Unit(unit,
data.WeaponsData.WeaponsList[Random.Range(0, data.WeaponsData.WeaponsList.Count - 1)], hexGrid);
var enemyController = new EnemyController(unit, enemy);
controllers.Add(enemyController);
units.Add(enemy);
AIAgent agent = new AIAgent(unit, enemy);
aiManager.AddAgent(agent);
enemy.onPlayerSpawned += agent.InitAgent;
}
});
@ -72,11 +83,14 @@ namespace Controller
hexGrid.OnHexPainted += paintedController.SetHexColors;
hexGrid.OnHexPainted += itemFabric.UpdateCellToOpenList;
hexGrid.OnHexPainted += paintedController.CheckDeath;
}
private List<Type> SetUpItems()
{
return new List<Type>() { typeof(Tower), typeof(AttackBonus), typeof(DefenceBonus) };
}
}
}

View File

@ -22,6 +22,7 @@ namespace HexFiled
private UnitColor _color;
private MeshRenderer _renderer;
public HexCell[] Neighbors => neighbors;
public UnitColor Color => _color;
public Item Item => _item;
@ -31,6 +32,14 @@ namespace HexFiled
_renderer = GetComponent<MeshRenderer>();
MusicController.Instance.AddAudioSource(gameObject);
_color = UnitColor.GREY;
if (!HexManager.CellByColor.ContainsKey(_color))
{
HexManager.CellByColor.Add(_color, new List<HexCell>(){this});
}
else
{
HexManager.CellByColor[_color].Add(this);
}
}
public void SetItem(Item item)
@ -69,6 +78,16 @@ namespace HexFiled
_renderer.material.mainTexture = HexGrid.Colors[color].Texture;
_color = color;
if (!HexManager.CellByColor.ContainsKey(_color))
{
HexManager.CellByColor.Add(_color, new List<HexCell>(){this});
}
else
{
HexManager.CellByColor[_color].Add(this);
}
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
gameObject);
Instantiate(HexGrid.Colors[color].VFXPrefab, transform);

View File

@ -112,8 +112,9 @@ namespace HexFiled
}
public void Init()
public void Init()
{
HexManager.CellByColor = new Dictionary<UnitColor, List<HexCell>>();
_cells = new HexCell[_height * _width];
for (int z = 0, i = 0; z < _height; z++)

View File

@ -0,0 +1,112 @@
using System.Collections.Generic;
using AI;
using DefaultNamespace.AI;
using Units;
using UnityEngine;
namespace HexFiled
{
public static class HexManager
{
public static Dictionary<UnitColor, (HexCell cell, Unit unit)> UnitCurrentCell;
public static Dictionary<UnitColor, List<HexCell>> CellByColor;
public static Dictionary<GameObject, AIAgent> agents;
public static void GetNearestDifferCell(UnitColor color, Queue<HexCell> path)
{
HexCell end = UnitCurrentCell[color].cell;
var itters = 0;
while (end.Color == color)
{
var tmp = end;
do
{
end = tmp.Neighbors[Random.Range(0, 5)];
itters++;
} while (end == null && itters < 5);
if (itters >= 5)
{
return;
}
path.Enqueue(end);
}
}
// public static ( bool hasPath, List<HexCell> field ) HasPath(UnitColor color)
// {
// var start = UnitCurrentCell[color];
// var end = start;
// List<HexCell> neighboursCells = new List<HexCell>();
// while (end.Color == color)
// {
// neighboursCells.AddRange(end.Neighbors);
// neighboursCells.ForEach(cell =>
// {
// if (cell.Color != color)
// {
// end = cell;
// }
// });
// }
//
// List<HexCell> closedList = new List<HexCell>();
// HexCell currentCell = start;
//
// Stack<HexCell> stackIterators = new Stack<HexCell>();
// stackIterators.Push(currentCell);
//
// closedList.Add(currentCell);
//
//
// while (stackIterators.Count >= 0)
// {
// if (currentCell == end)
// return (true, null);
//
// List<HexCell> openList = new List<HexCell>();
//
// foreach (var neighbour in currentCell.GetListNeighbours())
// {
// if (neighbour == null)
// {
// return (true, null);
// }
//
//
// if (closedList.Contains(neighbour) || neighbour.Color != start.Color) continue;
// openList.Add(neighbour);
// if (neighbour.GetListNeighbours().Contains(end))
// {
// return (true, null);
// }
// }
//
//
// if (openList.Count > 0)
// {
// currentCell = openList[Random.Range(0, openList.Count - 1)];
// closedList.Add(currentCell);
// stackIterators.Push(currentCell);
// }
// else
// {
// if (stackIterators.Count == 0)
// {
// return (false, closedList);
// }
//
// currentCell = stackIterators.Pop();
// }
//
// if (currentCell.GetListNeighbours().Contains(end))
// {
// return (true, null);
// }
// }
//
// return (false, closedList);
// }
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4cbcb8d61a914507b1d6ca7c912db1ed
timeCreated: 1641496225

View File

@ -2,20 +2,31 @@ using System;
using System.Collections.Generic;
using System.Linq;
using DefaultNamespace;
using Units;
using Random = UnityEngine.Random;
namespace HexFiled
{
public class PaintedController
{
public static Dictionary<UnitColor, (HexCell previos, HexCell curent)> UnitCurrentCell;
private HexCell _cell;
public PaintedController()
{
UnitCurrentCell = new Dictionary<UnitColor, (HexCell, HexCell)>();
HexManager.UnitCurrentCell = new Dictionary<UnitColor, (HexCell cell, Unit unit)>();
}
public void CheckDeath(HexCell cell)
{
foreach (var cells in HexManager.UnitCurrentCell)
{
if (cells.Value.cell == cell && cells.Value.unit.Color != cell.Color)
{
cells.Value.unit.Death();
}
}
}
public void SetHexColors(HexCell cell)
{
_cell = cell;
@ -30,39 +41,14 @@ namespace HexFiled
foreach (var item in hexByColorDict)
{
if (item.Key == cell.Color && item.Value.Count >= 2 && item.Value.Count < 6 &&
UnitCurrentCell.ContainsKey(cell.Color))
HexManager.UnitCurrentCell.ContainsKey(cell.Color))
{
HexDirection direction = new HexDirection();
for (int i = 0; i < 6; i++)
{
var neighbour = UnitCurrentCell[cell.Color].previos.GetNeighbor((HexDirection)i);
if (neighbour == UnitCurrentCell[cell.Color].curent)
{
direction = (HexDirection)i;
}
}
var openDirection = direction.PlusSixtyDeg();
var closeDirection = direction.MinusSixtyDeg();
if (TryPaintHexList(Round(
UnitCurrentCell[cell.Color].previos.GetNeighbor(closeDirection),
UnitCurrentCell[cell.Color].previos.GetNeighbor(openDirection)),
cell.Color))
{
TryPaintHexList(Round(
UnitCurrentCell[cell.Color].previos.GetNeighbor(openDirection),
UnitCurrentCell[cell.Color].previos.GetNeighbor(closeDirection)),
cell.Color);
}
cell.GetListNeighbours().ForEach(x =>
{
if (x != null && x.Color == UnitColor.GREY)
if (x != null && x.Color != cell.Color)
{
TryPaintHexList(Round(x, null), cell.Color);
PaintHexList(Round(x, null), cell.Color);
}
});
}
@ -70,31 +56,29 @@ namespace HexFiled
if (item.Value.Count > 0 && item.Key != UnitColor.GREY && item.Key != cell.Color)
{
foreach (var path in from cellNeighbour in item.Value
where UnitCurrentCell.ContainsKey(item.Key)
select HasPath(cellNeighbour, UnitCurrentCell[item.Key].curent)
where HexManager.UnitCurrentCell.ContainsKey(item.Key)
select HasPath(cellNeighbour, HexManager.UnitCurrentCell[item.Key].cell)
into path
where !path.hasPath
select path)
{
TryPaintHexList(path, UnitColor.GREY);
PaintHexList(path, UnitColor.GREY);
}
}
}
}
private bool TryPaintHexList((bool hasPath, List<HexCell> field) path, UnitColor color)
private void PaintHexList((bool hasPath, List<HexCell> field) path, UnitColor color)
{
if (!path.hasPath)
{
List<Action<UnitColor>> actions = new List<Action<UnitColor>>();
if (path.hasPath) return;
List<Action<UnitColor>> actions = new List<Action<UnitColor>>();
path.field.ForEach(x => actions.Add(x.PaintHex));
path.field.ForEach(x => actions.Add(x.PaintHex));
TimerHelper.Instance.StartTimer(actions, 0.05f, color);
}
TimerHelper.Instance.StartTimer(actions, 0.05f, color);
return path.hasPath;
}
private Dictionary<UnitColor, List<HexCell>> DifferentHexByColor(List<HexCell> cellsList)

View File

@ -45,7 +45,7 @@ namespace Items
{
if (Time.time - time >= _spawnTime)
{
List<HexCell> closedList = PaintedController.UnitCurrentCell.Select(unitCells => unitCells.Value.curent)
List<HexCell> closedList = HexManager.UnitCurrentCell.Select(unitCells => unitCells.Value.cell)
.ToList();
time = Time.time;
var cell = _openList[Random.Range(0, _openList.Count - 1)];

View File

@ -1,5 +1,6 @@
using Controller;
using Data;
using DefaultNamespace.AI;
using DG.Tweening;
using Runtime.Controller;
using Units;
@ -17,6 +18,7 @@ namespace Chars
_enemy = enemy;
_camera = Camera.main;
}
public void FixedExecute()

View File

@ -3,13 +3,13 @@ using System.Collections.Generic;
using Chars;
using Data;
using DefaultNamespace;
using DefaultNamespace.AI;
using DG.Tweening;
using HexFiled;
using Items;
using UnityEngine;
using Weapons;
using Object = UnityEngine.Object;
using Random = UnityEngine.Random;
namespace Units
@ -23,6 +23,8 @@ namespace Units
private HexCell _cell;
private HexGrid _hexGrid;
public Action<GameObject> onPlayerSpawned;
public Action OnDeath;
private Animator _animator;
private UnitView _unitView;
private bool _isBusy;
@ -37,8 +39,14 @@ namespace Units
private int _attackBonus;
private int _defenceBonus;
public BarCanvas BarCanvas => _barCanvas;
public bool IsBusy
{
get => _isBusy;
set => _isBusy = value;
}
public bool IsBusy => _isBusy;
public UnitView UnitView => _unitView;
public bool IsAlive => _isAlive;
public UnitColor Color => _data.color;
@ -80,8 +88,12 @@ namespace Units
public void Move(HexDirection direction)
{
if (!_cell.GetNeighbor(direction) || _isBusy) return;
_unitView.StopHardCapture();
if (!_cell.GetNeighbor(direction)
|| _isBusy
|| (_cell.GetNeighbor(direction).Color != UnitColor.GREY
&& _cell.GetNeighbor(direction) ==
HexManager.UnitCurrentCell[_cell.GetNeighbor(direction).Color].cell)) return;
if (_cell.GetNeighbor(direction).Color == _data.color)
{
DoTransit(direction);
@ -106,9 +118,8 @@ namespace Units
{
_isBusy = true;
_isCapturing = _data.color != _cell.GetNeighbor(direction).Color;
var previousCell = _cell;
_cell = _cell.GetNeighbor(direction);
PaintedController.UnitCurrentCell[_data.color] = (previousCell, _cell);
HexManager.UnitCurrentCell[_data.color] = (_cell, this);
RotateUnit(new Vector2((_cell.transform.position - _instance.transform.position).normalized.x,
(_cell.transform.position - _instance.transform.position).normalized.z));
_animator.SetTrigger("Move");
@ -159,12 +170,12 @@ namespace Units
}
//
PaintedController.UnitCurrentCell.Add(_data.color, (null, _cell));
HexManager.UnitCurrentCell.Add(_data.color, (_cell, this));
//
_instance = Object.Instantiate(_data.unitPrefa, _cell.transform.parent);
_instance.transform.localPosition = _cell.transform.localPosition;
onPlayerSpawned?.Invoke(_instance);
_isAlive = true;
_animator = _instance.GetComponent<Animator>();
_unitView = _instance.GetComponent<UnitView>();
@ -175,6 +186,7 @@ namespace Units
MusicController.Instance.AddAudioSource(_instance);
_mana = _data.maxMana;
_hp = _data.maxHP;
onPlayerSpawned?.Invoke(_instance);
SetUpActions();
}
}
@ -220,7 +232,6 @@ namespace Units
else
{
CaptureHex();
}
_isHardToCapture = false;
@ -280,7 +291,7 @@ namespace Units
_barCanvas.HealthBar.DOFillAmount(hp / maxHp, 0.5f).SetEase(Ease.InQuad);
}
private void Death()
public void Death()
{
_unitView.OnStep -= MoveEnd;
_unitView.OnAttackEnd -= AttackEnd;
@ -288,6 +299,7 @@ namespace Units
_unitView.OnHit -= Damage;
_isAlive = false;
_animator.SetTrigger("Death");
OnDeath.Invoke();
MusicController.Instance.PlayAudioClip(MusicController.Instance.MusicData.SfxMusic.Death, _instance);
MusicController.Instance.RemoveAudioSource(_instance);
}

View File

@ -9,11 +9,14 @@ public class BarCanvas : MonoBehaviour
[SerializeField] private Image manaBar;
[SerializeField] private ShotUIView shotPrefab;
[SerializeField] private GameObject grid;
[SerializeField] private Image captureBar;
public Image HealthBar => healthBar;
public Image ManaBar => manaBar;
public ShotUIView ShotUIView => shotPrefab;
public Image CaptureBar => captureBar;
public Stack<ShotUIView> SpawnShotUI(int count)
{
Stack<ShotUIView> stack = new Stack<ShotUIView>();

View File

@ -18,7 +18,6 @@ public class UnitView : MonoBehaviour
public Action<int> OnHit;
[SerializeField] private GameObject barCanvas;
[SerializeField] private GameObject aimCanvas;
[SerializeField] private Image captureBar;
private Stack<ShotUIView> _shootUIStack;
@ -53,13 +52,15 @@ public class UnitView : MonoBehaviour
public void HardCaptureHex(HexCell cell)
{
captureBar.gameObject.SetActive(true);
_unit.IsBusy = true;
_unit.BarCanvas.CaptureBar.gameObject.SetActive(true);
_sequence = DOTween.Sequence();
_sequence.Append(captureBar.DOFillAmount(1f, 0f).SetEase(Ease.Linear).OnComplete(() =>
_sequence.Append(_unit.BarCanvas.CaptureBar.DOFillAmount(1f, 0f).SetEase(Ease.Linear).OnComplete(() =>
{
_capureHex?.Invoke();
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
captureBar.gameObject.SetActive(false);
_unit.BarCanvas.CaptureBar.DOFillAmount(0f, 1f).SetEase(Ease.Linear).OnComplete(()=>_unit.IsBusy = false);
_unit.BarCanvas.CaptureBar.gameObject.SetActive(false);
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
cell.gameObject);
}));
@ -69,8 +70,9 @@ public class UnitView : MonoBehaviour
public void StopHardCapture()
{
_sequence.Kill();
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
captureBar.gameObject.SetActive(false);
_unit.BarCanvas.CaptureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
_unit.BarCanvas.CaptureBar.gameObject.SetActive(false);
_unit.IsBusy = false;
}
public bool Shoot()

View File

@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using UnityEditor.PackageManager.Requests;
public class add : MonoBehaviour
{