Items #3

Merged
dddushesss merged 61 commits from Alexei into main 2022-01-05 12:48:28 +00:00
15 changed files with 129398 additions and 118 deletions
Showing only changes of commit cd2a468be9 - Show all commits

View File

@ -123,6 +123,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 2346010271288414180}
m_Modifications:
- target: {fileID: 8170153791668043265, guid: 0d230cc8be529a542a08cb878ab14b18,
type: 3}
propertyPath: deadZone
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
type: 3}
propertyPath: m_Pivot.x
@ -312,6 +317,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 2346010271288414180}
m_Modifications:
- target: {fileID: 8170153791668043265, guid: 0d230cc8be529a542a08cb878ab14b18,
type: 3}
propertyPath: deadZone
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
type: 3}
propertyPath: m_Pivot.x

View File

@ -0,0 +1,114 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &173658
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5048506557351598633}
- component: {fileID: 1519512647055872152}
m_Layer: 0
m_Name: Demo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5048506557351598633
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 173658}
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: 3231781222043810133}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1519512647055872152
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 173658}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a65dba056618ef244aa5f7a41138f642, type: 3}
m_Name:
m_EditorClassIdentifier:
upgradeInputModule: 1
skyboxRoot: {fileID: 0}
--- !u!1 &42099737742954725
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3231781222043810133}
- component: {fileID: 4539800119007132250}
- component: {fileID: 2608960281581768207}
m_Layer: 5
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3231781222043810133
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 42099737742954725}
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: 5048506557351598633}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4539800119007132250
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 42099737742954725}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!114 &2608960281581768207
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 42099737742954725}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0

View File

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

View File

@ -25,8 +25,8 @@ MonoBehaviour:
maxHP: 100
- isPlayer: 0
spawnPos:
x: 0
z: 0
x: 3
z: 4
unitPrefa: {fileID: 3762867976042010436, guid: d00f156879942114488e4db0689a3fb7,
type: 3}
color: 4

128827
Assets/Scenes/NewMainMenu.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9d1635b49ffb40046b1a26c6b196047e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6024,6 +6024,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1353495746}
- {fileID: 1699264744}
- {fileID: 1950172469}
m_Father: {fileID: 2022521803}
m_RootOrder: 1
@ -42047,7 +42048,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1764495478}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
@ -56668,7 +56669,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 794131626}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
@ -63982,7 +63983,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 579933763}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
m_Name:
@ -94224,6 +94225,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 770133914}
m_CullTransparentMesh: 0
--- !u!1 &773992580
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 773992581}
- component: {fileID: 773992583}
- component: {fileID: 773992582}
m_Layer: 5
m_Name: Tracking_Bomb
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &773992581
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 773992580}
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: 1764495478}
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: 512, y: 512}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &773992582
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 773992580}
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: 21300000, guid: 8cb7c29bde3668342abe6070af1e539f, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &773992583
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 773992580}
m_CullTransparentMesh: 1
--- !u!1 &774772168
GameObject:
m_ObjectHideFlags: 0
@ -95279,6 +95355,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 410082027}
- {fileID: 1771874720}
- {fileID: 541802040}
m_Father: {fileID: 1907116938}
m_RootOrder: 1
@ -126630,7 +126707,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Opti
m_text: Snake
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4995422ffdb954b70a642f73eb1442ea, type: 2}
m_sharedMaterial: {fileID: 2517202264660172603, guid: 4995422ffdb954b70a642f73eb1442ea,
@ -131997,7 +132074,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Opti
m_text: Golem
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4995422ffdb954b70a642f73eb1442ea, type: 2}
m_sharedMaterial: {fileID: 2517202264660172603, guid: 4995422ffdb954b70a642f73eb1442ea,
@ -132976,10 +133053,10 @@ RectTransform:
m_Father: {fileID: 579933764}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0.0006716683}
m_SizeDelta: {x: 1080, y: 3023.0513}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -549.52606}
m_SizeDelta: {x: 0, y: 1099.0513}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1363478783
CanvasRenderer:
@ -166645,6 +166722,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1698589137}
m_CullTransparentMesh: 1
--- !u!1 &1699264743
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1699264744}
- component: {fileID: 1699264746}
- component: {fileID: 1699264745}
m_Layer: 5
m_Name: Snake
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1699264744
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1699264743}
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: 19694751}
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: 512, y: 512}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1699264745
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1699264743}
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: 21300000, guid: 330a83ab20ac61240b6a9a8063be2229, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1699264746
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1699264743}
m_CullTransparentMesh: 1
--- !u!1 &1700134256
GameObject:
m_ObjectHideFlags: 0
@ -175186,6 +175338,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1525565145}
- {fileID: 773992581}
- {fileID: 345381069}
m_Father: {fileID: 1214260613}
m_RootOrder: 1
@ -175360,6 +175513,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1770907644}
m_CullTransparentMesh: 0
--- !u!1 &1771874719
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1771874720}
- component: {fileID: 1771874722}
- component: {fileID: 1771874721}
m_Layer: 5
m_Name: Golem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1771874720
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1771874719}
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: 794131626}
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.000015258789, y: -0.000015258789}
m_SizeDelta: {x: 512, y: 512}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1771874721
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1771874719}
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: 21300000, guid: 847c972a9e9b1b4428d455d9c188840f, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1771874722
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1771874719}
m_CullTransparentMesh: 1
--- !u!1 &1773532984
GameObject:
m_ObjectHideFlags: 0
@ -183071,7 +183299,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Opti
m_text: Tracking bomb
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 4995422ffdb954b70a642f73eb1442ea, type: 2}
m_sharedMaterial: {fileID: 2517202264660172603, guid: 4995422ffdb954b70a642f73eb1442ea,
@ -205720,7 +205948,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 19694751}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;
@ -24,6 +25,10 @@ namespace HexFiled
_color = UnitColor.GREY;
}
public List<HexCell> GetListNeighbours()
{
return neighbors.ToList();
}
public void SetDictionary(Dictionary<UnitColor, CellColor> colors)
{
_cellColor = colors;

View File

@ -11,5 +11,15 @@
{
return (int)direction < 3 ? (direction + 3) : (direction - 3);
}
public static HexDirection PlusSixtyDeg(this HexDirection direction)
{
return (int) direction < 5? (direction + 1) : (HexDirection)0;
}
public static HexDirection MinusSixtyDeg(this HexDirection direction)
{
return (int)direction > 0 ? (direction - 1) : (HexDirection)5;
}
}
}

View File

@ -1,18 +1,17 @@
using System.Collections.Generic;
using Data;
using UnityEngine;
namespace HexFiled
{
public class PaintedController
{
public static Dictionary<UnitColor, HexCell> unitCurrentCell;
public static Dictionary<UnitColor, (HexCell previos, HexCell curent)> UnitCurrentCell;
private HexCell _cell;
public PaintedController()
{
unitCurrentCell = new Dictionary<UnitColor, HexCell>();
UnitCurrentCell = new Dictionary<UnitColor, (HexCell, HexCell)>();
}
public void SetHexColors(HexCell cell)
@ -32,9 +31,9 @@ namespace HexFiled
{
foreach (var cellNeighbour in item.Value)
{
if(unitCurrentCell.ContainsKey(item.Key))
if (UnitCurrentCell.ContainsKey(item.Key))
{
var path = HasPath(cellNeighbour, unitCurrentCell[item.Key]);
var path = HasPath(cellNeighbour, UnitCurrentCell[item.Key].curent);
if (!path.hasPath)
{
path.field.ForEach(x => x.PaintHex(UnitColor.GREY));
@ -42,19 +41,55 @@ namespace HexFiled
}
}
}
else if (item.Key == UnitColor.GREY)
if (item.Key == cell.Color && item.Value.Count >= 2 && item.Value.Count < 6 &&
UnitCurrentCell.ContainsKey(cell.Color))
{
HexDirection direction = new HexDirection();
HexDirection openDirection = new HexDirection();
HexDirection closeDirection = 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;
}
}
openDirection = direction.PlusSixtyDeg();
closeDirection = direction.MinusSixtyDeg();
var path = HasPath(
UnitCurrentCell[cell.Color].previos.GetNeighbor(closeDirection),
UnitCurrentCell[cell.Color].previos.GetNeighbor(openDirection)
);
if (!path.hasPath)
{
path.field.ForEach(x => x.PaintHex(cell.Color));
}
else
{
path = HasPath(
UnitCurrentCell[cell.Color].previos.GetNeighbor(openDirection),
UnitCurrentCell[cell.Color].previos.GetNeighbor(closeDirection)
);
if (!path.hasPath)
{
path.field.ForEach(x => x.PaintHex(cell.Color));
}
}
}
}
}
private Dictionary<UnitColor, List<HexCell>> DifferentHexByColor(List<HexCell> cellsList)
{
Dictionary<UnitColor, List<HexCell>> resultDict = new Dictionary<UnitColor, List<HexCell>>();
cellsList.ForEach(cell => {
cellsList.ForEach(cell =>
{
if (cell != null && resultDict.ContainsKey(cell.Color))
{
resultDict[cell.Color].Add(cell);
@ -63,7 +98,6 @@ namespace HexFiled
{
resultDict.Add(cell.Color, new List<HexCell> { cell });
}
});
return resultDict;
}
@ -79,21 +113,50 @@ namespace HexFiled
closedList.Add(currentCell);
while (stackIteators.Count >= 0)
{
if (currentCell == end)
return (true, closedList);
List<HexCell> openList = new List<HexCell>();
if(end.Color != UnitColor.GREY)
{
if (end.Color != start.Color)
{
return (true, null);
}
for (int i = 0; i < 6; i++)
{
HexCell neighbour = currentCell.GetNeighbor((HexDirection)i);
if(!closedList.Contains(neighbour) && neighbour.Color == end.Color)
if (neighbour == null)
{
return (true, null);
}
if (!closedList.Contains(neighbour) && neighbour.Color == start.Color)
{
openList.Add(neighbour);
}
}
}
else
{
for (int i = 0; i < 6; i++)
{
HexCell neighbour = currentCell.GetNeighbor((HexDirection)i);
if (neighbour == null)
{
return (true, null);
}
if (!closedList.Contains(neighbour) &&
neighbour.Color != _cell.Color)
{
openList.Add(neighbour);
}
}
}
if (openList.Count > 0)
{
@ -107,73 +170,17 @@ namespace HexFiled
{
return (false, closedList);
}
currentCell = stackIteators.Pop();
}
if (currentCell.GetListNeighbours().Contains(end))
{
return (true, null);
}
}
return (false, closedList);
}
}
}
/*
if(start == end)
return true;
if(currentCell.Cell.coordinates.Y < end.coordinates.Y)
{
var cellNeighbour = currentCell.Cell.GetNeighbor(HexDirection.W);
if (!closedList.Contains(cellNeighbour) && cellNeighbour.Color == end.Color)
{
stackIteators.Push(currentCell);
currentCell = new HexIterator(cellNeighbour, true, currentCell.Cell);
closedList.Add(currentCell.Cell);
continue;
}
}
else if(currentCell.Cell.coordinates.Y > end.coordinates.Y)
{
var cellNeighbour = currentCell.Cell.GetNeighbor(HexDirection.E);
if(!closedList.Contains(cellNeighbour) && cellNeighbour.Color == end.Color)
{
stackIteators.Push(currentCell);
currentCell = new HexIterator(cellNeighbour, true, currentCell.Cell);
closedList.Add(currentCell.Cell);
continue;
}
}
// Z
if(currentCell.Cell.coordinates.Z > end.coordinates.Z)
{
var cellNeighbour = currentCell.Cell.GetNeighbor(HexDirection.SE);
if (!closedList.Contains(cellNeighbour) && cellNeighbour.Color == end.Color)
{
stackIteators.Push(currentCell);
currentCell = new HexIterator(cellNeighbour, true, currentCell.Cell);
closedList.Add(currentCell.Cell);
continue;
}
}
else if(currentCell.Cell.coordinates.Z < end.coordinates.Z)
{
var cellNeighbour = currentCell.Cell.GetNeighbor(HexDirection.NW);
if(!closedList.Contains(cellNeighbour) && cellNeighbour.Color == end.Color)
{
stackIteators.Push(currentCell);
currentCell = new HexIterator(cellNeighbour, true, currentCell.Cell);
closedList.Add(currentCell.Cell);
continue;
}
}
currentCell = stackIteators.Pop();
if(stackIteators.Count == 0)
return false;
*/

View File

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

View File

@ -77,7 +77,9 @@ namespace Units
{
_isBusy = true;
_isCapturing = _data.color != _cell.GetNeighbor(direction).Color;
var previousCell = _cell;
_cell = _cell.GetNeighbor(direction);
PaintedController.UnitCurrentCell[_data.color] = (previousCell, _cell);
RotateUnit(new Vector2((_cell.transform.position - _instance.transform.position).normalized.x,
(_cell.transform.position - _instance.transform.position).normalized.z));
_animator.SetTrigger("Move");
@ -88,7 +90,6 @@ namespace Units
private void CaptureHex()
{
_cell.PaintHex(_data.color);
PaintedController.unitCurrentCell[_data.color] =_cell;
}
private void SetAnimLength()
@ -118,11 +119,17 @@ namespace Units
_cell.PaintHex(_data.color);
for (int i = 0; i < 6; i++)
{
_cell.GetNeighbor((HexDirection)i)?.PaintHex(_data.color);
var neigh = _cell.GetNeighbor((HexDirection)i);
neigh?.PaintHex(_data.color);
for (int j = 0; j < 6; j++)
{
neigh?.GetNeighbor((HexDirection)j)?.PaintHex(_data.color);
}
}
//
PaintedController.unitCurrentCell.Add(_data.color, _cell);
PaintedController.UnitCurrentCell.Add(_data.color, (null, _cell));
//
_instance = Object.Instantiate(_data.unitPrefa, _cell.transform.parent);
@ -156,13 +163,13 @@ namespace Units
_isHardToCapture = false;
return;
}
if (_isHardToCapture)
{
_unitView.HardCaptureHex(_cell);
}
else
{
CaptureHex();
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
_cell.gameObject);
@ -267,6 +274,7 @@ namespace Units
{
Death();
}
_hp -= dmg;
UpdateBarCanvas();
}

View File

@ -50,9 +50,9 @@ public class UnitView : MonoBehaviour
{
captureBar.gameObject.SetActive(true);
_sequence = DOTween.Sequence();
_sequence.Append(captureBar.DOFillAmount(1f, 0f).OnComplete(() =>
_sequence.Append(captureBar.DOFillAmount(1f, 0f).SetEase(Ease.Linear).OnComplete(() =>
{
_capureHex.Invoke();
_capureHex?.Invoke();
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
captureBar.gameObject.SetActive(false);
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,

View File

@ -0,0 +1,38 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
public class ToolBarController : MonoBehaviour
{
[SerializeField] private GameObject playMenu;
[SerializeField] private GameObject cardsMenu;
[SerializeField] private GameObject shopMenu;
[SerializeField] private GameObject equipmentMenu;
[SerializeField] private GameObject mainMenu;
[SerializeField] private Button playMenuButton;
[SerializeField] private Button cardsMenuButton;
[SerializeField] private Button shopMenuButton;
[SerializeField] private Button equipmentMenuButton;
[SerializeField] private Button modeMenuButton;
[SerializeField] private float duration;
[SerializeField] private Ease ease;
private void Awake()
{
playMenuButton.onClick.AddListener(() => ScrollToMenu(playMenu));
cardsMenuButton.onClick.AddListener(() => ScrollToMenu(cardsMenu));
shopMenuButton.onClick.AddListener(() => ScrollToMenu(shopMenu));
equipmentMenuButton.onClick.AddListener(() => ScrollToMenu(equipmentMenu));
}
private void ScrollToMenu(GameObject menu)
{
mainMenu.transform.DOMove(-menu.transform.localPosition, duration).SetEase(ease);
}
}

View File

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