private void BeginBlock(string name) { switch (_state) { case States.file: if (name == "technology") { _area = new TechArea(); _state = States.area; return; } break; case States.area: if (name == "level") { _theo = new TheoryTech(); _state = States.theory; return; } break; case States.theory: if (name == "application") { _app = new AppliedTech(); _state = States.applied; return; } break; case States.applied: if (name == "required") { _state = States.reqs; return; } else if (name == "effects") { _state = States.effect; return; } break; case States.effect: if (name == "command") { _eff = new TechEffect(); _state = States.command; return; } break; } throw new ClauzewitzSyntaxException("Unexpected block '" + name + "' in state " + _state.ToString()); }
// Unit Tech Effects void ModifyUT(int nl, int ol, UnitController targ) { TechEffect[] copyArr = new TechEffect[ol]; for(int x = 0; x < copyArr.Length; x++){ copyArr[x] = targ.techEffect[x]; } targ.techEffect = new TechEffect[nl]; if(nl > ol){ for(int x = 0; x < copyArr.Length; x++){ targ.techEffect[x] = copyArr[x]; } targ.techEffect[nl-1] = new TechEffect(); } else{ for(int x = 0; x < targ.techEffect.Length; x++){ targ.techEffect[x] = copyArr[x]; } } }