public void SwitchCharacter(int inID) { reserveUnits.Add(currentID, inBattleUnits[currentID]); inBattleUnits.Add(inID, reserveUnits[inID]); reserveUnits.Remove(inID); inBattleUnits.Remove(currentID); turnSystem.RemoveUnit(currentID); turnSystem.AddUnit(inBattleUnits[inID].GetComponent <PlayerUnit>()); targetSystem.ChangeInBattleTargets(currentID, inID); Vector3 tempPos = reserveUnits[currentID].transform.position; reserveUnits[currentID].transform.position = inBattleUnits[inID].transform.position; inBattleUnits[inID].transform.position = tempPos; reserveUnits[currentID].GetComponent <PlayerUnit>().OnSwitch(); onTurnEnd.Raise(); }
private void Start() { List <int> inBattleIDs = new List <int>(); foreach (GameObject g in inBattleUnits) { Unit unit = g.GetComponent <Unit>(); turnSystem.AddUnit(unit); inBattleIDs.Add(unit.ID); characterSwitcher.AddUnit(g, true); } foreach (GameObject g in reserveUnits) { characterSwitcher.AddUnit(g, false); } dummySkill.TargetSystem = targetSystem; dummySkill.OnTurnEndEvent = onTurnEnd; targetSystem.SetInBattleTargets(inBattleIDs); StartCoroutine(LateStart(1)); }