Recode finished version 1

This commit is contained in:
firefighter198
2021-10-05 15:45:27 +02:00
parent af90d64644
commit cb3e7563a6
11 changed files with 9338 additions and 7758 deletions
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
+97 -1
View File
@@ -4,8 +4,104 @@ using UnityEngine;
public class Bishop : Character public class Bishop : Character
{ {
public static readonly Vector2[,] moves =
{
{
//up, right
new Vector2(1, 1),
new Vector2(2, 2),
new Vector2(3, 3),
new Vector2(4, 4),
new Vector2(5, 5),
new Vector2(6, 6),
new Vector2(7, 7),
new Vector2(8.5f, 8.5f),
},
{
//up, left
new Vector2(-1, 1),
new Vector2(-2, 2),
new Vector2(-3, 3),
new Vector2(-4, 4),
new Vector2(-5, 5),
new Vector2(-6, 6),
new Vector2(-7, 7),
new Vector2(-8.5f, 8.5f),
},
{
//down, right
new Vector2(1, -1),
new Vector2(2, -2),
new Vector2(3, -3),
new Vector2(4, -4),
new Vector2(5, -5),
new Vector2(6, -6),
new Vector2(7, -7),
new Vector2(8.5f, -8.5f),
},
{
//down, left
new Vector2(-1, -1),
new Vector2(-2, -2),
new Vector2(-3, -3),
new Vector2(-4, -4),
new Vector2(-5, -5),
new Vector2(-6, -6),
new Vector2(-7, -7),
new Vector2(-8.5f, -8.5f),
}
};
public override bool[,] GetValidMoves(Cell[,] cells, Game game) public override bool[,] GetValidMoves(Cell[,] cells, Game game)
{ {
return null; bool[,] result = new bool[8, 8];
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 8; j++)
{
Vector3 testPosition = transform.position + (Vector3)moves[i, j];
Cell testCell = game.GetCellOnPosition(testPosition);
if (testCell != null)
{
if (testCell.connected == null)
{
int x, y;
string nameX = testCell.gameObject.name.Substring(5, 1);
string nameY = testCell.gameObject.name.Substring(7, 1);
x = int.Parse(nameX);
y = int.Parse(nameY);
result[x, y] = true;
}
else
{
if (testCell.connected.team != game.currentTeam)
{
int x, y;
string nameX = testCell.gameObject.name.Substring(5, 1);
string nameY = testCell.gameObject.name.Substring(7, 1);
x = int.Parse(nameX);
y = int.Parse(nameY);
result[x, y] = true;
}
j = 8;
}
}
}
}
return result;
} }
} }
+1 -1
View File
@@ -40,7 +40,7 @@ public class Game : MonoBehaviour
Destroy(tempCell.connected.gameObject); Destroy(tempCell.connected.gameObject);
} }
tempCell.connected = clickedCell.connected; tempCell.connected = clickedCell.connected;
tempCell.connected.gameObject.transform.position = (tempCell.gameObject.transform.position); tempCell.connected.gameObject.transform.position = (tempCell.gameObject.transform.position + Vector3.back);
clickedCell.connected = null; clickedCell.connected = null;
DeColorAllCells(); DeColorAllCells();
+55 -1
View File
@@ -4,8 +4,62 @@ using UnityEngine;
public class King : Character public class King : Character
{ {
public static readonly Vector2[] moves =
{
//up
new Vector2(0, 1),
//down
new Vector2(0, -1),
//right
new Vector2(1, 0),
//left
new Vector2(-1, 0),
//up, right
new Vector2(1, 1),
//up, left
new Vector2(-1, 1),
//down, right
new Vector2(1, -1),
//down, left
new Vector2(-1, -1)
};
public override bool[,] GetValidMoves(Cell[,] cells, Game game) public override bool[,] GetValidMoves(Cell[,] cells, Game game)
{ {
return null; bool[,] result = new bool[8, 8];
foreach (Vector2 move in moves)
{
Vector3 testPosition = transform.position + (Vector3)move;
Cell testCell = game.GetCellOnPosition(testPosition + Vector3.back);
if (testCell != null)
{
int x, y;
string nameX = testCell.gameObject.name.Substring(5, 1);
string nameY = testCell.gameObject.name.Substring(7, 1);
x = int.Parse(nameX);
y = int.Parse(nameY);
if (testCell.connected == null)
{
result[x, y] = true;
}
else
{
Character testCharacter = testCell.connected;
if (testCharacter.team != game.currentTeam)
{
result[x, y] = true;
}
}
}
}
return result;
} }
} }
+1 -3
View File
@@ -41,8 +41,7 @@ public class Knight : Character
x = int.Parse(nameX); x = int.Parse(nameX);
y = int.Parse(nameY); y = int.Parse(nameY);
if (IsPositionInGrid(x, y))
{
if (testCell.connected == null) if (testCell.connected == null)
{ {
result[x, y] = true; result[x, y] = true;
@@ -57,7 +56,6 @@ public class Knight : Character
} }
} }
} }
}
return result; return result;
} }
+144 -1
View File
@@ -4,8 +4,151 @@ using UnityEngine;
public class Queen : Character public class Queen : Character
{ {
public static readonly Vector2[,] moves =
{
{
//up
new Vector2(0, 1),
new Vector2(0, 2),
new Vector2(0, 3),
new Vector2(0, 4),
new Vector2(0, 5),
new Vector2(0, 6),
new Vector2(0, 7),
new Vector2(0, 8.5f), //.5 because of calculation error in game ^^
},
{
//down
new Vector2(0, -1),
new Vector2(0, -2),
new Vector2(0, -3),
new Vector2(0, -4),
new Vector2(0, -5),
new Vector2(0, -6),
new Vector2(0, -7),
new Vector2(0, -8.5f),
},
{
//right
new Vector2(1, 0),
new Vector2(2, 0),
new Vector2(3, 0),
new Vector2(4, 0),
new Vector2(5, 0),
new Vector2(6, 0),
new Vector2(7, 0),
new Vector2(8.5f, 0)
},
{
//left
new Vector2(-1, 0),
new Vector2(-2, 0),
new Vector2(-3, 0),
new Vector2(-4, 0),
new Vector2(-5, 0),
new Vector2(-6, 0),
new Vector2(-7, 0),
new Vector2(-8.5f, 0)
},
{
//up, right
new Vector2(1, 1),
new Vector2(2, 2),
new Vector2(3, 3),
new Vector2(4, 4),
new Vector2(5, 5),
new Vector2(6, 6),
new Vector2(7, 7),
new Vector2(8.5f, 8.5f),
},
{
//up, left
new Vector2(-1, 1),
new Vector2(-2, 2),
new Vector2(-3, 3),
new Vector2(-4, 4),
new Vector2(-5, 5),
new Vector2(-6, 6),
new Vector2(-7, 7),
new Vector2(-8.5f, 8.5f),
},
{
//down, right
new Vector2(1, -1),
new Vector2(2, -2),
new Vector2(3, -3),
new Vector2(4, -4),
new Vector2(5, -5),
new Vector2(6, -6),
new Vector2(7, -7),
new Vector2(8.5f, -8.5f),
},
{
//down, left
new Vector2(-1, -1),
new Vector2(-2, -2),
new Vector2(-3, -3),
new Vector2(-4, -4),
new Vector2(-5, -5),
new Vector2(-6, -6),
new Vector2(-7, -7),
new Vector2(-8.5f, -8.5f),
}
};
public override bool[,] GetValidMoves(Cell[,] cells, Game game) public override bool[,] GetValidMoves(Cell[,] cells, Game game)
{ {
return null; bool[,] result = new bool[8, 8];
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
Vector3 testPosition = transform.position + (Vector3)moves[i, j];
Cell testCell = game.GetCellOnPosition(testPosition);
if(testCell != null)
{
if (testCell.connected == null)
{
int x, y;
string nameX = testCell.gameObject.name.Substring(5, 1);
string nameY = testCell.gameObject.name.Substring(7, 1);
x = int.Parse(nameX);
y = int.Parse(nameY);
result[x, y] = true;
}
else
{
if (testCell.connected.team != game.currentTeam)
{
int x, y;
string nameX = testCell.gameObject.name.Substring(5, 1);
string nameY = testCell.gameObject.name.Substring(7, 1);
x = int.Parse(nameX);
y = int.Parse(nameY);
result[x, y] = true;
}
j = 8;
}
}
}
}
return result;
} }
} }
+40 -1
View File
@@ -6,7 +6,6 @@ public class Rook : Character
{ {
private static readonly Vector2[,] moves = private static readonly Vector2[,] moves =
{ {
{ {
//up //up
new Vector2(0, 1), new Vector2(0, 1),
@@ -60,7 +59,47 @@ public class Rook : Character
{ {
bool[,] result = new bool[8, 8]; bool[,] result = new bool[8, 8];
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 8; j++)
{
Vector3 testPosition = transform.position + (Vector3)moves[i, j];
Cell testCell = game.GetCellOnPosition(testPosition);
if(testCell != null)
{
if (testCell.connected == null)
{
int x, y;
string nameX = testCell.gameObject.name.Substring(5, 1);
string nameY = testCell.gameObject.name.Substring(7, 1);
x = int.Parse(nameX);
y = int.Parse(nameY);
result[x, y] = true;
}
else
{
if (testCell.connected.team != game.currentTeam)
{
int x, y;
string nameX = testCell.gameObject.name.Substring(5, 1);
string nameY = testCell.gameObject.name.Substring(7, 1);
x = int.Parse(nameX);
y = int.Parse(nameY);
result[x, y] = true;
}
j = 8;
}
}
}
}
return result; return result;
} }
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,12 +1,3 @@
Base path: 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data', plugins path 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data/PlaybackEngines' Base path: 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data', plugins path 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: compileSnippet
insize=731 file=Assets/DefaultResourcesExtra/Sprites/Default pass=<Unnamed Pass> cachingPP=1 ppOnly=0 stripLineD=0 buildPlatform=13 rsLen=0 pKW=UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_FULL_HDR uKW= dKW=ETC1_EXTERNAL_ALPHA INSTANCING_ON PIXELSNAP_ON UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30 flags=0 lang=0 type=Vertex platform=d3d11 reqs=1 mask=6 start=32 ok=1 outsize=890
Cmd: compileSnippet
insize=731 file=Assets/DefaultResourcesExtra/Sprites/Default pass=<Unnamed Pass> cachingPP=1 ppOnly=0 stripLineD=0 buildPlatform=13 rsLen=0 pKW=UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_FULL_HDR uKW= dKW=ETC1_EXTERNAL_ALPHA INSTANCING_ON PIXELSNAP_ON UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30 flags=0 lang=0 type=Fragment platform=d3d11 reqs=1 mask=6 start=32 ok=1 outsize=454
Unhandled exception: Protocol error - failed to read magic number (error -2147483644, transferred 0/4)
Quitting shader compiler process
@@ -1,15 +1,3 @@
Base path: 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data', plugins path 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data/PlaybackEngines' Base path: 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data', plugins path 'C:/Program Files/Unity/Hub/Editor/2021.1.13f1/Editor/Data/PlaybackEngines'
Cmd: initializeCompiler Cmd: initializeCompiler
Cmd: compileSnippet
insize=16577 file=Assets/DefaultResourcesExtra/Skybox/Procedural pass=<Unnamed Pass> cachingPP=1 ppOnly=0 stripLineD=0 buildPlatform=13 rsLen=0 pKW=UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING uKW=_SUNDISK_NONE dKW=_SUNDISK_SIMPLE _SUNDISK_HIGH_QUALITY UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30 flags=0 lang=0 type=Vertex platform=d3d11 reqs=33 mask=6 start=20 ok=1 outsize=5414
Cmd: compileSnippet
insize=16577 file=Assets/DefaultResourcesExtra/Skybox/Procedural pass=<Unnamed Pass> cachingPP=1 ppOnly=0 stripLineD=0 buildPlatform=13 rsLen=0 pKW=UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING uKW=_SUNDISK_NONE dKW=_SUNDISK_SIMPLE _SUNDISK_HIGH_QUALITY UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30 flags=0 lang=0 type=Fragment platform=d3d11 reqs=33 mask=6 start=20 ok=1 outsize=474
Cmd: compileSnippet
insize=16577 file=Assets/DefaultResourcesExtra/Skybox/Procedural pass=<Unnamed Pass> cachingPP=1 ppOnly=0 stripLineD=0 buildPlatform=13 rsLen=0 pKW=UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING uKW=_SUNDISK_SIMPLE dKW=_SUNDISK_NONE _SUNDISK_HIGH_QUALITY UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30 flags=0 lang=0 type=Vertex platform=d3d11 reqs=33 mask=6 start=20 ok=1 outsize=5698
Cmd: compileSnippet
insize=16577 file=Assets/DefaultResourcesExtra/Skybox/Procedural pass=<Unnamed Pass> cachingPP=1 ppOnly=0 stripLineD=0 buildPlatform=13 rsLen=0 pKW=UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING uKW=_SUNDISK_SIMPLE dKW=_SUNDISK_NONE _SUNDISK_HIGH_QUALITY UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_RGBM_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30 flags=0 lang=0 type=Fragment platform=d3d11 reqs=33 mask=6 start=20 ok=1 outsize=934