private void SpawnEnemies()
{
ORK.Game.ActiveGroup.ClearTargets();
ORK.Game.Combatants.Clear(false);
for (int j = 0; j < _enemyCellCordList.Count; j++)
{
_enemyDeploymentCellList.Add(_mainBattleGrid.GetCell(_enemyCellCordList[j].x, _enemyCellCordList[j].y));
}
for (int i = 0; i < _mainBattle.settings.combatant.Length; i++)
{
}
FactionSetting enemyfaction = new FactionSetting("Enemies"); //Change Here
Group enemyArmy = new Group(enemyfaction); //1 is the ID of the enemy faction...
for (int i = 0; i < _enemyUnitIDList.Count; i++)
{
Combatant c = ORK.Combatants.Create(_enemyUnitIDList[i], enemyArmy, true, true);
c.Init();
_enemyDeploymentCellList[i].SetCombatant(c, false);
c.Object.Spawn(_enemyDeploymentCellList[i].transform.position, true, new Vector3(0, 0f, 0), false, Vector3.one);
c.GameObject.GetComponent<CombatantWrapper>().SetDirection(true);
_enemyUnitCbtList.Add(c);
_mainBattle.SetNextEnemySpot(c, GroupAdvantageType.Enemy);
}
enemyArmy.SetBattleGroup(_enemyUnitCbtList, true);
_mainBattle.StartGroup(enemyArmy, this);
//This is the equivalent of the "Place on grid" node...
GameObject[] spots = new GameObject[_enemyUnitCbtList.Count];
for (int i = 0; i < _enemyUnitCbtList.Count; i++)
{
_enemyUnitCbtList[i].Grid.Cell = _enemyDeploymentCellList[i];
spots[i] = _enemyDeploymentCellList[i].gameObject;
}
_mainBattle.enemySpot = spots;
}
It looks like you're new here. If you want to get involved, click one of these buttons!
Use ORK.Battle instead - this is the battle handler and has functions to join and remove combatants from battle. E.g. Join to join (either a list of combatants or a single combatant), RemoveFromBattle or RemoveCombatant (e.g. for also getting loot).
Joining a battle this way will also give them a free battle spot and use the Join Battle Animation (Combatants > Combatants in the battle animations) to animate this.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!