diff --git a/theProject/Assets/Scripts/Entities/Entity.cs b/theProject/Assets/Scripts/Entities/Entity.cs index 2441bf8c..b9613dc5 100644 --- a/theProject/Assets/Scripts/Entities/Entity.cs +++ b/theProject/Assets/Scripts/Entities/Entity.cs @@ -21,6 +21,8 @@ public class Entity : MonoBehaviour [HideInInspector] public UnityEvent OnDeath = new UnityEvent(); + Vector2Int tileCoord; + public Team GetOwnTeam() { return myTeam; @@ -93,4 +95,8 @@ public class Entity : MonoBehaviour { healthPointsText.text = healthPoints.ToString() + "/" + maxHealthPoints.ToString(); } + public void SetTileCoords(Vector2Int tileCoordinates) + { + tileCoord = tileCoordinates; + } } diff --git a/theProject/Assets/Scripts/Managers/SquadManager.cs b/theProject/Assets/Scripts/Managers/SquadManager.cs index 5235c370..57135759 100644 --- a/theProject/Assets/Scripts/Managers/SquadManager.cs +++ b/theProject/Assets/Scripts/Managers/SquadManager.cs @@ -10,14 +10,16 @@ public class SquadManager : MonoBehaviour Squad enemySquad; private void Awake() { - playerSquad = Instantiate(squadPrefab).GetComponent(); - playerSquad.gameObject.name = "Player Squad"; - playerSquad.transform.SetParent(transform); + enemySquad = Instantiate(squadPrefab).GetComponent(); enemySquad.gameObject.name = "Enemy Squad"; enemySquad.transform.SetParent(transform); + playerSquad = Instantiate(squadPrefab).GetComponent(); + playerSquad.gameObject.name = "Player Squad"; + playerSquad.transform.SetParent(transform); + } // Update is called once per frame void Update() diff --git a/theProject/Assets/Scripts/Managers/TilemapManager.cs b/theProject/Assets/Scripts/Managers/TilemapManager.cs index bfe1f408..3c1c2294 100644 --- a/theProject/Assets/Scripts/Managers/TilemapManager.cs +++ b/theProject/Assets/Scripts/Managers/TilemapManager.cs @@ -105,7 +105,7 @@ public class TilemapManager : MonoBehaviour else tiles[x, y].standingEntity = Instantiate(soldierPrefab, tilemap.CellToWorld(new Vector3Int(x, y, 0)) + WORLD_SPACE_OFFSET, Quaternion.identity).GetComponent(); - if (tiles[x, y].standingSoldier == null) + if (tiles[x, y].standingEntity == null) return false; if (isAlly) @@ -159,7 +159,7 @@ public class TilemapManager : MonoBehaviour public static bool MoveSoldierS(int x1, int y1, int x2, int y2) { - return ins.MoveSoldier(x1, y1, x2, y2); + return ins.MoveEntity(x1, y1, x2, y2); } // ---------- private methods