fixed merge

This commit is contained in:
Gabriel Ksawery Skowron-Rodriguez 2022-05-23 14:30:01 +02:00
parent a0564ec377
commit 530aee0cf8
3 changed files with 13 additions and 5 deletions

View File

@ -21,6 +21,8 @@ public class Entity : MonoBehaviour
[HideInInspector] public UnityEvent<Entity> OnDeath = new UnityEvent<Entity>(); [HideInInspector] public UnityEvent<Entity> OnDeath = new UnityEvent<Entity>();
Vector2Int tileCoord;
public Team GetOwnTeam() public Team GetOwnTeam()
{ {
return myTeam; return myTeam;
@ -93,4 +95,8 @@ public class Entity : MonoBehaviour
{ {
healthPointsText.text = healthPoints.ToString() + "/" + maxHealthPoints.ToString(); healthPointsText.text = healthPoints.ToString() + "/" + maxHealthPoints.ToString();
} }
public void SetTileCoords(Vector2Int tileCoordinates)
{
tileCoord = tileCoordinates;
}
} }

View File

@ -10,14 +10,16 @@ public class SquadManager : MonoBehaviour
Squad enemySquad; Squad enemySquad;
private void Awake() private void Awake()
{ {
playerSquad = Instantiate(squadPrefab).GetComponent<Squad>();
playerSquad.gameObject.name = "Player Squad";
playerSquad.transform.SetParent(transform);
enemySquad = Instantiate(squadPrefab).GetComponent<Squad>(); enemySquad = Instantiate(squadPrefab).GetComponent<Squad>();
enemySquad.gameObject.name = "Enemy Squad"; enemySquad.gameObject.name = "Enemy Squad";
enemySquad.transform.SetParent(transform); enemySquad.transform.SetParent(transform);
playerSquad = Instantiate(squadPrefab).GetComponent<Squad>();
playerSquad.gameObject.name = "Player Squad";
playerSquad.transform.SetParent(transform);
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()

View File

@ -105,7 +105,7 @@ public class TilemapManager : MonoBehaviour
else else
tiles[x, y].standingEntity = Instantiate(soldierPrefab, tilemap.CellToWorld(new Vector3Int(x, y, 0)) + WORLD_SPACE_OFFSET, Quaternion.identity).GetComponent<Soldier>(); tiles[x, y].standingEntity = Instantiate(soldierPrefab, tilemap.CellToWorld(new Vector3Int(x, y, 0)) + WORLD_SPACE_OFFSET, Quaternion.identity).GetComponent<Soldier>();
if (tiles[x, y].standingSoldier == null) if (tiles[x, y].standingEntity == null)
return false; return false;
if (isAlly) if (isAlly)
@ -159,7 +159,7 @@ public class TilemapManager : MonoBehaviour
public static bool MoveSoldierS(int x1, int y1, int x2, int y2) 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 // ---------- private methods