Example #1
0
    public override void RunIt()
    {
        base.RunIt();

        if (shouldCountLaneTimes)
        {
            laneTimeCounter = MathfPlus.DecByDeltatimeToZero(laneTimeCounter);

            if (laneTimeCounter == 0)
            {
                SetSoldierCurrentLaneNum(soldierCurrentLaneNum + 1, true);
            }
        }

        if (isFollowWaiting)
        {
            if ((followDatJob == null) || (followDatJob != null && followDatJob.status == LogicJobStatus.Finished))
            {
                isFollowWaiting  = false;
                followJobCounter = MathfPlus.GetRandomFloat(followDelayTimeMin, followDelayTimeMax);
            }
        }

        if (followJobCounter > 0)
        {
            followJobCounter = MathfPlus.DecByDeltatimeToZero(followJobCounter);
        }

StartSteps:

        #region 1 Running
        if (step == 1) //Running
        {
            if (IsCreatingSoldiersStoppedAndAllSoldsDead())
            {
                SetFinished(true);
                return;
            }

            if (needsToBeFinished)
            {
                SetStep(2);
                goto StartSteps;
            }

            if (fightReg.respawnPointCollection != null)
            {
                if (!isFollowWaiting && followJobCounter == 0)
                {
                    if (fightReg.respawnPointCollection.IsReady())
                    {
                        CreateAndInitSoldier();
                    }
                }
            }

            if (grenadeEnabled)
            {
                if (!nowReadyForGreandeLaunch && grenadeCount > 0)
                {
                    grenadeDelayTimeCounter = MathfPlus.DecByDeltatimeToZero(grenadeDelayTimeCounter);
                }

                if (!grenadeIsControlledByOwnerGroup)
                {
                    if (CanSetReadyForLaunchGrenade())
                    {
                        SetItsNowReadyForLaunchGrenade();
                    }
                }
            }
        }
        #endregion

        #region 2 Start Finishing
        if (step == 2) //StartFinishing
        {
            StopCreatingMoreSoldiers();

            if (GeneralStats.IsCharacterAlive(controlledSoldier))
            {
                curFightInRegAct.SetNeedsToBeFinished(evenStopMovingForFinish);
            }

            SetStep(3);
        }
        #endregion

        #region 3 Check Finished
        if (step == 3) //Check Finished
        {
            if (!GeneralStats.IsCharacterAlive(controlledSoldier))
            {
                SetFinished(true);
                return;
            }
            else
            {
                //<Alpha>
                if (needsToBeFinished)
                {
                    curFightInRegAct.SetNeedsToBeFinished(evenStopMovingForFinish);
                }
                //</Alpha>

                if (curFightInRegAct.status == SoldierAction.ActionStatusEnum.Finished)
                {
                    SetFinished(true);
                    return;
                }
            }
        }
        #endregion

EndSteps:
        ;
    }