public void Execute(Bitmap Image) { CurrState.Execute(Image); if (CurrState == States[0]) //SS { Val = ValidLocation.FALSE; CSearchState Curr = CurrState as CSearchState; if (Curr.TargetFoundCycle >= Curr.MaxCycles) { (States[1] as CTrackState).CurrX = Curr.CurrX; (States[1] as CTrackState).CurrY = Curr.CurrY; CurrState = States[1]; Curr.TargetFoundCycle = 0; } } else //TS { if (CurrState.Validity == ValidLocation.FALSE) { CurrState = States[0]; Val = ValidLocation.FALSE; } else { Val = ValidLocation.TRUE; } } }
public CStateMgr() { States = new CState[2]; CSearchState SS = new CSearchState(); CTrackState TS = new CTrackState(); States[0] = SS; States[1] = TS; CurrState = SS; }