mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-20 09:52:24 +01:00
feat: detect edges in formation
This commit is contained in:
parent
635c7d2b0a
commit
6146d64dba
55
theProject/.vscode/settings.json
vendored
Normal file
55
theProject/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"files.exclude":
|
||||||
|
{
|
||||||
|
"**/.DS_Store":true,
|
||||||
|
"**/.git":true,
|
||||||
|
"**/.gitmodules":true,
|
||||||
|
"**/*.booproj":true,
|
||||||
|
"**/*.pidb":true,
|
||||||
|
"**/*.suo":true,
|
||||||
|
"**/*.user":true,
|
||||||
|
"**/*.userprefs":true,
|
||||||
|
"**/*.unityproj":true,
|
||||||
|
"**/*.dll":true,
|
||||||
|
"**/*.exe":true,
|
||||||
|
"**/*.pdf":true,
|
||||||
|
"**/*.mid":true,
|
||||||
|
"**/*.midi":true,
|
||||||
|
"**/*.wav":true,
|
||||||
|
"**/*.gif":true,
|
||||||
|
"**/*.ico":true,
|
||||||
|
"**/*.jpg":true,
|
||||||
|
"**/*.jpeg":true,
|
||||||
|
"**/*.png":true,
|
||||||
|
"**/*.psd":true,
|
||||||
|
"**/*.tga":true,
|
||||||
|
"**/*.tif":true,
|
||||||
|
"**/*.tiff":true,
|
||||||
|
"**/*.3ds":true,
|
||||||
|
"**/*.3DS":true,
|
||||||
|
"**/*.fbx":true,
|
||||||
|
"**/*.FBX":true,
|
||||||
|
"**/*.lxo":true,
|
||||||
|
"**/*.LXO":true,
|
||||||
|
"**/*.ma":true,
|
||||||
|
"**/*.MA":true,
|
||||||
|
"**/*.obj":true,
|
||||||
|
"**/*.OBJ":true,
|
||||||
|
"**/*.asset":true,
|
||||||
|
"**/*.cubemap":true,
|
||||||
|
"**/*.flare":true,
|
||||||
|
"**/*.mat":true,
|
||||||
|
"**/*.meta":true,
|
||||||
|
"**/*.prefab":true,
|
||||||
|
"**/*.unity":true,
|
||||||
|
"build/":true,
|
||||||
|
"Build/":true,
|
||||||
|
"Library/":true,
|
||||||
|
"library/":true,
|
||||||
|
"obj/":true,
|
||||||
|
"Obj/":true,
|
||||||
|
"ProjectSettings/":true,
|
||||||
|
"temp/":true,
|
||||||
|
"Temp/":true
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -30,8 +30,20 @@ public class Formation : MonoBehaviour
|
|||||||
private Vector2Int CalculateSoldierCoordinates(in int soldierNumber, in Vector2Int coordinates)
|
private Vector2Int CalculateSoldierCoordinates(in int soldierNumber, in Vector2Int coordinates)
|
||||||
{
|
{
|
||||||
// Horizontal line we change x
|
// Horizontal line we change x
|
||||||
|
TilemapManager.TileState tileState = TilemapManager.GetTileState(coordinates.x + soldierNumber, coordinates.y);
|
||||||
|
if ( tileState == TilemapManager.TileState.free)
|
||||||
|
{
|
||||||
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x + soldierNumber, coordinates.y);
|
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x + soldierNumber, coordinates.y);
|
||||||
return soldierCoordinates;
|
return soldierCoordinates;
|
||||||
|
} else if (tileState == TilemapManager.TileState.taken)
|
||||||
|
{
|
||||||
|
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x, coordinates.y);
|
||||||
|
return soldierCoordinates;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Vector2Int soldierCoordinates = new Vector2Int(coordinates.x, coordinates.y);
|
||||||
|
return soldierCoordinates;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -174,12 +174,12 @@ public class TilemapManager : MonoBehaviour
|
|||||||
|
|
||||||
// ---------- private methods
|
// ---------- private methods
|
||||||
|
|
||||||
private TileState GetTileState(int x, int y)
|
public static TileState GetTileState(int x, int y)
|
||||||
{
|
{
|
||||||
if (x < 0 || y < 0 || x >= mapSize.x || y >= mapSize.y)
|
if (x < 0 || y < 0 || x >= ins.mapSize.x || y >= ins.mapSize.y)
|
||||||
return TileState.outOfBounds;
|
return TileState.outOfBounds;
|
||||||
|
|
||||||
if (tiles[x, y].standingEntity == null)
|
if (ins.tiles[x, y].standingEntity == null)
|
||||||
return TileState.free;
|
return TileState.free;
|
||||||
|
|
||||||
return TileState.taken;
|
return TileState.taken;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user