//Initiates enemy party public void EnemyPartyBuilder() { //When a battle starts from a level, the enemy pumps data to the enemy party array. If the battle is initiated from //the Combat scene, a debugging party is loaded if (enemyParty == null || enemyParty.Length == 0) { enemyParty = new Enemy[dE.Length]; for (int i = 0; i < enemyParty.Length; i++) { enemyParty[i] = Instantiate(dE[i]); } debugSession = true; } else { debugSession = false; } livingEnemies = enemyParty.Length; //Attaches visual component of enemy to Scriptable Object for (int i = 0; i < enemyParty.Length; i++) { GameObject g = Instantiate(enemyParty[i].baseBody); g.transform.SetParent(eDisplay[i].transform);//Attaches visual component of enemy to Scriptable Object g.transform.localPosition = Vector2.zero; CombatAnim ca = g.GetComponent <CombatAnim>(); ca.movePoint = g.transform.parent.GetChild(1); ca.retractPoint = g.transform.parent.GetChild(2); enemyParty[i].currentBody = g; } }
//Initiates ally party public void AllyPartyBuilder() { //When a battle starts from a level, the player pumps data to the ally party array. If the battle is initiated from //the Combat scene, a debugging party is loaded List <string> allies = ListCreator.combatMinionsList; numMinions = debugSession ? 3 : allies.Count;//Check if debug session allyParty = new Entity[numMinions + 1]; all = new Entity[numMinions + livingEnemies + 1];//Array to hold all entities on the field allyParty[0] = player1; GameObject gameobject = Instantiate(allyParty[0].baseBody); gameobject.transform.SetParent(aDisplay[0].transform);//Attaches visual component of enemy to Scriptable Object gameobject.transform.localPosition = Vector2.zero; CombatAnim ca = gameobject.GetComponent <CombatAnim>(); ca.movePoint = gameobject.transform.parent.GetChild(1); ca.retractPoint = gameobject.transform.parent.GetChild(2); all[0] = player1; allyParty[0].currentBody = gameobject; for (int i = 1; i <= numMinions; i++) { //Loads either defaults or specified enemies depening on whether it is a debug session allyParty[i] = debugSession ? Instantiate(dA[i - 1]) : Instantiate((Entity)Resources.Load("Enemies/" + allies[i - 1], typeof(Object))); allyParty[i].isAlly = true; GameObject g = Instantiate(allyParty[i].baseBody); g.transform.SetParent(aDisplay[i].transform);//Attaches visual component of enemy to Scriptable Object g.transform.localPosition = Vector2.zero; ca = g.GetComponent <CombatAnim>(); ca.movePoint = g.transform.parent.GetChild(1); ca.retractPoint = g.transform.parent.GetChild(2); all[i] = allyParty[i]; allyParty[i].currentBody = g; } //((Player)allyParty[0]).currentPaint = ((Player)allyParty[0]).currentPaint; }