Killed Characters are put to the side
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,96 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bde12a919cdf6874cb517b5f5203db06
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -8,11 +8,17 @@ public class Game : MonoBehaviour
|
|||||||
public Camera cam;
|
public Camera cam;
|
||||||
|
|
||||||
private Cell[,] cells = new Cell[8, 8];
|
private Cell[,] cells = new Cell[8, 8];
|
||||||
|
private Cell[] killedCharacCellsWhite = new Cell[16];
|
||||||
|
private int indexKilledCharacCellWhite = 0, indexKilledCharacCellBlack = 0;
|
||||||
|
private Cell[] killedCharacCellsBlack = new Cell[16];
|
||||||
public Teams currentTeam = Teams.White;
|
public Teams currentTeam = Teams.White;
|
||||||
|
private bool areKilledCellsActive = false;
|
||||||
|
|
||||||
private Cell clickedCell = null;
|
private Cell clickedCell = null;
|
||||||
private List<Cell> validMovesList = new List<Cell>();
|
private List<Cell> validMovesList = new List<Cell>();
|
||||||
|
|
||||||
|
public bool isPaused = false;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
//Get all the Cells from the hierachy
|
//Get all the Cells from the hierachy
|
||||||
@@ -23,9 +29,17 @@ public class Game : MonoBehaviour
|
|||||||
cells[x, y] = GameObject.Find("Field" + y + "," + x).gameObject.GetComponent<Cell>();
|
cells[x, y] = GameObject.Find("Field" + y + "," + x).gameObject.GetComponent<Cell>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
killedCharacCellsWhite[i] = GameObject.Find("AddCell" + i).gameObject.GetComponent<Cell>();
|
||||||
|
killedCharacCellsBlack[i] = GameObject.Find("AddCell" + i + " (1)").gameObject.GetComponent<Cell>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
{
|
||||||
|
if (!isPaused)
|
||||||
{
|
{
|
||||||
//Check if left clicked
|
//Check if left clicked
|
||||||
if (Input.GetMouseButtonDown(0))
|
if (Input.GetMouseButtonDown(0))
|
||||||
@@ -33,14 +47,31 @@ public class Game : MonoBehaviour
|
|||||||
//Get the clicked cell
|
//Get the clicked cell
|
||||||
Cell tempCell = GetCellOnPositionMouse(Input.mousePosition);
|
Cell tempCell = GetCellOnPositionMouse(Input.mousePosition);
|
||||||
|
|
||||||
|
if (tempCell != null)
|
||||||
|
{
|
||||||
if (validMovesList.Contains(tempCell))
|
if (validMovesList.Contains(tempCell))
|
||||||
{
|
{
|
||||||
if (tempCell.connected != null)
|
if (tempCell.connected != null)
|
||||||
{
|
{
|
||||||
Destroy(tempCell.connected.gameObject);
|
if (tempCell.connected.team == Teams.White)
|
||||||
|
{
|
||||||
|
|
||||||
|
tempCell.connected.gameObject.transform.position = killedCharacCellsWhite[indexKilledCharacCellWhite].gameObject.transform.position + Vector3.back;
|
||||||
|
killedCharacCellsWhite[indexKilledCharacCellWhite].connected = tempCell.connected;
|
||||||
|
indexKilledCharacCellWhite++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempCell.connected.gameObject.transform.position = killedCharacCellsBlack[indexKilledCharacCellBlack].gameObject.transform.position + Vector3.back;
|
||||||
|
killedCharacCellsBlack[indexKilledCharacCellBlack].connected = tempCell.connected;
|
||||||
|
indexKilledCharacCellBlack++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tempCell.connected = clickedCell.connected;
|
tempCell.connected = clickedCell.connected;
|
||||||
tempCell.connected.gameObject.transform.position = (tempCell.gameObject.transform.position + Vector3.back);
|
tempCell.connected.gameObject.transform.position =
|
||||||
|
(tempCell.gameObject.transform.position + Vector3.back);
|
||||||
|
|
||||||
clickedCell.connected = null;
|
clickedCell.connected = null;
|
||||||
DeColorAllCells();
|
DeColorAllCells();
|
||||||
@@ -57,7 +88,6 @@ public class Game : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
//if the clickedCell == tempCell, deselect the cell
|
//if the clickedCell == tempCell, deselect the cell
|
||||||
if (clickedCell == tempCell)
|
if (clickedCell == tempCell)
|
||||||
{
|
{
|
||||||
@@ -72,6 +102,7 @@ public class Game : MonoBehaviour
|
|||||||
ColorCellExclusive(clickedCell, new Color(.5f, .1f, .1f));
|
ColorCellExclusive(clickedCell, new Color(.5f, .1f, .1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//check if there is a clicked cell
|
//check if there is a clicked cell
|
||||||
if (clickedCell != null)
|
if (clickedCell != null)
|
||||||
@@ -98,6 +129,7 @@ public class Game : MonoBehaviour
|
|||||||
{
|
{
|
||||||
ColorCell(x, y, new Color(.1f, .5f, .1f));
|
ColorCell(x, y, new Color(.1f, .5f, .1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
validMovesList.Add(cells[x, y]);
|
validMovesList.Add(cells[x, y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,6 +139,7 @@ public class Game : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Reset all colors of the cells
|
//Reset all colors of the cells
|
||||||
private void DeColorAllCells()
|
private void DeColorAllCells()
|
||||||
@@ -178,10 +211,30 @@ public class Game : MonoBehaviour
|
|||||||
//Shoot a raycast from mousePointer / touch position
|
//Shoot a raycast from mousePointer / touch position
|
||||||
RaycastHit2D hit = Physics2D.Raycast(position, Vector3.forward);
|
RaycastHit2D hit = Physics2D.Raycast(position, Vector3.forward);
|
||||||
if (hit.collider != null)
|
if (hit.collider != null)
|
||||||
|
{
|
||||||
|
if (ArrayContainsCell2D(hit.collider.gameObject.GetComponent<Cell>(), cells) || areKilledCellsActive)
|
||||||
{
|
{
|
||||||
result = hit.collider.gameObject.GetComponent<Cell>();
|
result = hit.collider.gameObject.GetComponent<Cell>();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool ArrayContainsCell2D(Cell cell, Cell[,] cells)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < cells.GetLength(0); x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < cells.GetLength(1); y++)
|
||||||
|
{
|
||||||
|
if (cells[x, y] == cell)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
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: compileSnippet
|
||||||
|
insize=3023 file=Assets/DefaultResourcesExtra/UI/UI/Default pass=Default 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= dKW=UNITY_UI_CLIP_RECT UNITY_UI_ALPHACLIP 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=1 mask=6 start=49 ok=1 outsize=1338
|
||||||
|
|
||||||
@@ -0,0 +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'
|
||||||
|
Cmd: initializeCompiler
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
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: compileSnippet
|
||||||
|
insize=3023 file=Assets/DefaultResourcesExtra/UI/UI/Default pass=Default 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= dKW=UNITY_UI_CLIP_RECT UNITY_UI_ALPHACLIP 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=1 mask=6 start=49 ok=1 outsize=550
|
||||||
|
|
||||||
Reference in New Issue
Block a user