From 077fed3feec54646c12e3562028e781374568f8f Mon Sep 17 00:00:00 2001 From: DyatelO Date: Wed, 29 Dec 2021 22:36:19 +0300 Subject: [PATCH 1/2] Debug forUnity --- .vscode/launch.json | 55 +++++++++++++++++++++++++++++++++++++++++++++ .vscode/tasks.json | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..8bcd690c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,55 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "name": "Unity Editor", + "type": "unity", + "path": "/G:/Unity/Jump_And_Grub/Library/EditorInstance.json", + "request": "launch" + }, + { + "name": "Windows Player", + "type": "unity", + "request": "launch" + }, + { + "name": "OSX Player", + "type": "unity", + "request": "launch" + }, + { + "name": "Linux Player", + "type": "unity", + "request": "launch" + }, + { + "name": "iOS Player", + "type": "unity", + "request": "launch" + }, + { + "name": "Android Player", + "type": "unity", + "request": "launch" + }, + { + "name": "Xbox One Player", + "type": "unity", + "request": "launch" + }, + { + "name": "PS4 Player", + "type": "unity", + "request": "launch" + }, + { + "name": "SwitchPlayer", + "type": "unity", + "request": "launch" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..008f20fa --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/Assembly-CSharp.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/Assembly-CSharp.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/Assembly-CSharp.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file From c6391c6441557dff0593b1edd0d01c834a9a79c1 Mon Sep 17 00:00:00 2001 From: DyatelO Date: Thu, 30 Dec 2021 20:14:47 +0300 Subject: [PATCH 2/2] no message --- Assets/Scripts/HexFiled/PaintedController.cs | 51 +++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/HexFiled/PaintedController.cs b/Assets/Scripts/HexFiled/PaintedController.cs index d4e64ad8..24a73fdc 100644 --- a/Assets/Scripts/HexFiled/PaintedController.cs +++ b/Assets/Scripts/HexFiled/PaintedController.cs @@ -37,7 +37,7 @@ namespace HexFiled } } } - else if (item.Key == UnitColor.GREY) + else if (item.Key != cell.Color) { } @@ -59,10 +59,56 @@ namespace HexFiled resultDict.Add(cell.Color, new List{cell}); } - } ); + } + ); return resultDict; } + + + private List FillRound(List cells) + { + List neighbourByColor = new List(); + for (int i = 0; i < 6; i++) + { + var neighbour = _cell.GetNeighbor((HexDirection)i); + if(neighbour.Color == _cell.Color) + { + neighbourByColor.Add(neighbour); + } + } + + if(neighbourByColor.Count > 1 && neighbourByColor.Count < 6) + { + + var start = neighbourByColor[Random.Range(0, neighbourByColor.Count - 1)]; + var end = neighbourByColor[Random.Range(0, neighbourByColor.Count - 1)]; + neighbourByColor.Remove(start); + + + var path = HasPath(start, end); + while(neighbourByColor.Count <= 0 && path.hasPath) + { + start = neighbourByColor[Random.Range(0, neighbourByColor.Count - 1)]; + end = neighbourByColor[Random.Range(0, neighbourByColor.Count - 1)]; + neighbourByColor.Remove(start); + path = HasPath(start, end); + } + + if(!path.hasPath) + { + + } + + foreach (var cell in cells) + { + + } + } + + + } + private ( bool hasPath , List field ) HasPath(HexCell start, HexCell end) { List closedList = new List(); @@ -73,6 +119,7 @@ namespace HexFiled closedList.Add(currentCell); + closedList.Add(_cell); while(stackIteators.Count >= 0 )