//USEFUL METHODS------------------------------------- #region USEFULMETHODS public void addTransition(myStateTransition _method, HGenericStateFSM _state) { allocateMyTransitions(indexTransitions + 1); myTransitions [indexTransitions] += _method; targetStateTransitions [indexTransitions] = _state; indexTransitions++; }
void allocateMyTransitions(int len) { if (len == 1) { //first allocation myTransitions = new myStateTransition[len]; targetStateTransitions = new HGenericStateFSM[len]; } else { //reallocate myStateTransition [] tempTrans = new myStateTransition[len]; HGenericStateFSM [] tempStates = new HGenericStateFSM[len]; //reallocate transition int i = 0; foreach (myStateTransition tr in myTransitions) { tempTrans[i] = tr; i++; } i = 0; foreach (HGenericStateFSM tr in targetStateTransitions) { tempStates[i] = tr; i++; } myTransitions = tempTrans; targetStateTransitions = tempStates; //targetStateNameTransitions = tempString; } }