void CreateNewSoldier(Vector3 spawnPos)
    {
        Transform newSoldier = Instantiate(soldierPrefab, spawnPos, Quaternion.identity) as Transform;

        newSoldier.parent = legion;
        SoldierEntity soldierEntity = newSoldier.GetComponent <SoldierEntity>();

        soldierEntity.SetColor(legionColor);
        soldierEntity.SetLayer("Player");
        soldierEntity.SetRivalLayer("Enemy");
    }
Exemple #2
0
    public void InitializeSoldiers(string side, Vector3 pos)
    {
        string rivalSide = side.StartsWith("Player") ? "Enemy" : "Player";

        for (int i = 0; i < soldierCount; i++)
        {
            Transform soldierTransform = Instantiate(soldierPrefab, pos, Quaternion.identity) as Transform;
            soldierTransform.parent = legion;

            SoldierEntity soldierEntity = soldierTransform.GetComponent <SoldierEntity>();
            soldierEntity.SetLayer(side);
            soldierEntity.SetRivalLayer(rivalSide);
            soldierEntity.SetColor(legionColor);
        }
    }