public void BenchClicked(int i) { Formation formation = new Formation(); int iFormation = Formation.iFormation; if (iFormation < Formation.SIZE) { if (!occupied[i]) { AddUnit(Formation.units[iFormation], i); formation.Destroy(iFormation); } else { Unit temp = units[i]; AddUnit(Formation.units[iFormation], i); formation.AddUnit(temp, iFormation); } } else if (iBench == SIZE && !occupied[i]) { iBench = SIZE; } else if (iBench == SIZE) { iBench = i; Info info = new Info(); info.ShowUnit(units[i]); } else { if (iBench != i) { if (!occupied[i]) { AddUnit(units[iBench], i); Destroy(iBench); } else { Unit temp = units[i]; AddUnit(units[iBench], i); AddUnit(temp, iBench); } } iBench = SIZE; } Formation.iFormation = Formation.SIZE; }