Exemple #1
0
    protected void SetChildNeedsToBeFinished(MapLogicJob _child)
    {
        MapLogicJob chl = _child;

        if (evenStopMovingForFinish)
        {
            chl.SetNeedsToBeFinished_EvenStopMoving();
        }
        else
        {
            chl.SetNeedsToBeFinished();
        }
    }
    public override void RunIt()
    {
        base.RunIt();

StartSteps:

        if (step == 1)
        {
            if (needsToBeFinished)
            {
                SetFinished(true);
                return;
            }

            SetCurrentJob(globalStepInfo_CurrentJobIndex);
            curGlobalStepInfo_CurJob.StartIt();

            SetStep(2);
        }

        if (step == 2)
        {
            curGlobalStepInfo_CurJob.RunIt();

            if (needsToBeFinished)
            {
                if (curGlobalStepInfo_CurJob == null)
                {
                    SetFinished(true);
                    return;
                }

                if (curGlobalStepInfo_CurJob.status == LogicJobStatus.Finished)
                {
                    SetFinished(true);
                    return;
                }

                SetChildNeedsToBeFinished(curGlobalStepInfo_CurJob);

                SetStep(3);
                goto EndSteps;
            }

            if (globalStepInfo_NewIndex > globalStepInfo_CurrentIndex)
            {
                if (curGlobalStepInfo_CurJob == null)
                {
                    SetStep(4);
                    goto StartSteps;
                }

                if (logGlobStepInfos[globalStepInfo_NewIndex].jobsForThisStep[0] == curGlobalStepInfo_CurJob)
                {
                    SetCurrentGlobalStepInfo(globalStepInfo_NewIndex);
                }
                else
                {
                    if (curGlobalStepInfo_CurJob.status == LogicJobStatus.Finished)
                    {
                        SetStep(4);
                        goto StartSteps;
                    }

                    curGlobalStepInfo_CurJob.SetNeedsToBeFinished();

                    //SetChildNeedsToBeFinished(curGlobalStepInfo_CurJob);

                    SetStep(3);
                    goto EndSteps;
                }
            }

            if (curGlobalStepInfo_CurJob.status == LogicJobStatus.Finished)
            {
                if (globalStepInfo_CurrentJobIndex < curGlobalStepInfo.jobsForThisStep.Length - 1)
                {
                    globalStepInfo_CurrentJobIndex++;
                    SetStep(1);
                }
            }
        }

        if (step == 3)
        {
            //<Alpha>
            if (needsToBeFinished)
            {
                SetChildNeedsToBeFinished(curGlobalStepInfo_CurJob);
            }
            //</Alpha>

            curGlobalStepInfo_CurJob.RunIt();

            if (curGlobalStepInfo_CurJob.status == LogicJobStatus.Finished)
            {
                if (needsToBeFinished)
                {
                    SetFinished(true);
                    return;
                }

                step = 4;
            }
        }

        if (step == 4)
        {
            SetCurrentGlobalStepInfo(globalStepInfo_NewIndex);
            step = 1;
        }

EndSteps:
        ;
    }