Пример #1
0
 /// <summary>
 /// Throw the exception when needed
 /// </summary>
 /// <param name="condition"></param>
 /// <param name="step"></param>
 /// <param name="message"></param>
 public static void TryThrow(bool condition, StepEnum step, string message)
 {
     if (!condition)
     {
         throw new UpdateException(step, message);
     }
 }
Пример #2
0
    public void HandleStepCompletion(StepEnum step)
    {
        switch (step)
        {
        case StepEnum.ProductSelection:
            _orderPlacementStep.PlaceOrder();
            break;

        case StepEnum.OrderPlacement:
            return;
        }
    }
Пример #3
0
        public List <AvgStepDto> GetStepList(StepEnum stepName)
        {
            IEnumerable <AvgStepDto> result = new List <AvgStepDto>();

            switch (stepName)
            {
            case StepEnum.AvgTwo:
                result = from s in Repository.All()
                         group s by s.TwoStep
                         into g
                         select new AvgStepDto
                {
                    AverageStep  = g.Key,
                    AvgStepCount = g.Count()
                };
                break;

            case StepEnum.AvgFour:
                result = from s in Repository.All()
                         group s by s.FourStep
                         into g
                         select new AvgStepDto
                {
                    AverageStep  = g.Key,
                    AvgStepCount = g.Count()
                };
                break;

            case StepEnum.AvgEight:
                result = from s in Repository.All()
                         group s by s.EightStep
                         into g
                         select new AvgStepDto
                {
                    AverageStep  = g.Key,
                    AvgStepCount = g.Count()
                };
                break;
            }
            var sumCount   = result.Sum(m => m.AvgStepCount);
            var resultList = result.OrderByDescending(m => m.AverageStep).ToList();

            foreach (var item in resultList)
            {
                item.Percent = Convert.ToDouble(item.AvgStepCount) / Convert.ToDouble(sumCount);
            }

            return(resultList);
        }
Пример #4
0
        public JsonResult GetStepList(string stepName)
        {
            StepEnum step = StepEnum.AvgTwo;

            switch (stepName)
            {
            case "avgTwo":
                step = StepEnum.AvgTwo;
                break;

            case "avgFour":
                step = StepEnum.AvgFour;
                break;

            case "avgEight":
                step = StepEnum.AvgEight;
                break;
            }
            var list = _average3dAppService.GetStepList(step);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
 public List <AvgStepDto> GetStepList(StepEnum stepName)
 {
     return(_service.GetStepList(stepName));
 }
Пример #6
0
    public override void UpdateAct()
    {
        base.UpdateAct();

        if (!otherSourcePlayerDetectionionProcessFinished)
        {
            if (mapLogic.IsPlayerDetectedInCampMode())
            {
                if (!otherSourcePlayerDetectionionProcessStarted)
                {
                    otherSourcePlayerDetectionionProcessStarted = true;

                    float distToPlayer = (PlayerCharacterNew.Instance.gameObject.transform.position - gameObject.transform.position).magnitude;

                    otherSourcePlayerDetectionTimeCounter = Random.Range(otherSourcePlayerDetectionMaxTimeBaseAmount_Min, otherSourcePlayerDetectionMaxTimeBaseAmount_Max) + otherSourcePlayerDetectionMaxTimeCoefOfDist * distToPlayer;
                }
                else
                {
                    otherSourcePlayerDetectionTimeCounter = MathfPlus.DecByDeltatimeToZero(otherSourcePlayerDetectionTimeCounter);

                    if (otherSourcePlayerDetectionTimeCounter == 0)
                    {
                        SetPlayerHasBeenDetected(false);

                        otherSourcePlayerDetectionionProcessFinished = true;
                    }
                }
            }
        }

Start:

        #region Start01
        if (step == StepEnum.Start01)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            if (useCurves)
            {
                curCurveInfoIndex = 0;

                step = StepEnum.UseCurves01;
            }
            else
            {
                selectedAnim = anims.GetRandomAnimName();

                soldInfo.StartNewMainAnimWithCrossfadeTime(selectedAnim, animToAnimCampCrossfadeTime);
                step = StepEnum.Update01;
            }
        }
        #endregion

        #region Update01
        if (step == StepEnum.Update01)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            if (IsPlayerInView())
            {
                DecPlayerDectectionCounter();
            }
            else
            {
                ResetPlayerDectectionCounter();
            }

            if (IsPlayerDetected())
            {
                SetPlayerHasBeenDetected(true);
            }

            if (IsNearLoudSoundsHappened())
            {
                SetPlayerHasBeenDetected(true);
            }
        }
        #endregion

        #region UseCurves01
        if (step == StepEnum.UseCurves01)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            curCurveInfo                  = curveInfos[curCurveInfoIndex];
            curAntaresCurve               = curCurveInfo.curve;
            selectedAnim                  = curCurveInfo.animsList.GetRandomAnimName();
            curCurveCFTime                = curCurveInfo.crossfadeTime;
            curCurveMaxSpeed              = curCurveInfo.speed;
            curCurvePointToStay           = curCurveInfo.pointToStay;
            curCurveEndMinSpeed           = curCurveInfo.endMinSpeed;
            curCurveEndLengthToDecSpeed   = curCurveInfo.endLengthToStartDecreasingSpeed;
            curCurve_SpeedInc_Speed       = curCurveInfo.speedInc_Speed;
            curCurve_SpeedDec_Speed       = curCurveInfo.speedDec_Speed;
            curCurvePointStayTime         = curCurveInfo.pointStayTime;
            curCurveEndLengthToChangeAnim = curCurveInfo.endLengthToChangeAnim;

            nextCurveInfoIndex = GetNextCurveInfoIndex();


            curCurveInfoCounter = 0;
            curCurve_CurSpeed   = 0;

            if (!nextAnimIsRanBefore)
            {
                soldInfo.StartNewMainAnimWithCrossfadeTime(selectedAnim, curCurveCFTime);
            }

            nextAnimIsRanBefore = false;
            nextAnim            = "";
            nextAnimCFTime      = 0;

            isFirstTickOnCurveInfo = true;

            step = StepEnum.UseCurves02;
        }
        #endregion

        #region UseCurves02
        if (step == StepEnum.UseCurves02)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            if (IsPlayerInView())
            {
                DecPlayerDectectionCounter();
            }
            else
            {
                ResetPlayerDectectionCounter();
            }

            if (IsPlayerDetected())
            {
                SetPlayerHasBeenDetected(true);
            }

            if (IsNearLoudSoundsHappened())
            {
                SetPlayerHasBeenDetected(true);
            }

            //

            if (curCurvePointToStay)
            {
                IncreasePointStayTimeCounter();

                SetPosAndRotByStayPoint();

                CheckIfNeedsStartNextAnimInStayMode();

                if (IsPointStayTimeFinished())
                {
                    step = StepEnum.UseCurves03;
                    goto Finish;
                }
            }
            else
            {
                if (IsSoldierReachedToTheEndMinSpeedArea())
                {
                    DecCurveInfoCurrentSpeedForEnd();
                }
                else
                {
                    IncCurveInfoCurrentSpeed();
                }

                IncreaseCurCurveCounterByCurrentSpeed();

                SetPosAndRotByCurCurve();

                CheckIfNeedsStartNextAnimInCurveMode();

                if (IsCurveCounterReachedToEnd())
                {
                    step = StepEnum.UseCurves03;
                    goto Start;
                }
            }

            isFirstTickOnCurveInfo = false;
        }
        #endregion

        #region UseCurves03
        if (step == StepEnum.UseCurves03)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            if (IsPlayerInView())
            {
                DecPlayerDectectionCounter();
            }
            else
            {
                ResetPlayerDectectionCounter();
            }

            if (IsPlayerDetected())
            {
                SetPlayerHasBeenDetected(true);
            }

            if (IsNearLoudSoundsHappened())
            {
                SetPlayerHasBeenDetected(true);
            }

            //

            curCurveInfoIndex = nextCurveInfoIndex;

            step = StepEnum.UseCurves01;
            goto Start;
        }
        #endregion

Finish:
        return;
    }
Пример #7
0
 public override void StartAct()
 {
     base.StartAct();
     step = StepEnum.Start01;
 }
Пример #8
0
    public override void UpdateAct()
    {
        base.UpdateAct();


Start:

        #region AnimToIdle01
        if (step == StepEnum.AnimToIdle01)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            animToAnimIdleCFTimeFinal = animToAnimIdleCrossfadeTime;
            step = StepEnum.AnimToIdle02;
        }
        #endregion

        #region AnimToIdle02
        if (step == StepEnum.AnimToIdle02)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            if (soldInfo.isDamageRecievedInThisRun)
            {
                dmg = soldInfo.firstDamage;

                if (ShouldTakeDamage(dmg))
                {
                    step = StepEnum.Damage01;
                    goto Start;
                }
            }

            selectedAnim = anims.GetRandomAnimName();
            soldAnimObj.animation[selectedAnim].time = 0;
            soldAnimObj.animation.CrossFade(selectedAnim, animToAnimIdleCFTimeFinal);
            step = StepEnum.Idle;
        }
        #endregion

        #region Damage01
        if (step == StepEnum.Damage01)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            selectedDamageAnim = animPackIdleDamage.GetRandomAnim(dmg);
            soldAnimObj.animation[selectedDamageAnim].time = 0;
            soldAnimObj.animation.CrossFade(selectedDamageAnim, animToAnimDmgCrossfadeTime);
            step = StepEnum.Damage02;
            goto Finish;
        }
        #endregion

        #region Damage02
        if (step == StepEnum.Damage02)
        {
            if (needsToBeFinished)
            {
                SetFinished(false);
                return;
            }

            float passedAnimTime = soldAnimObj.animation[selectedDamageAnim].time;
            if (passedAnimTime >= soldAnimObj.animation[selectedDamageAnim].length - animToAnimIdleCrossfadeTime)
            {
                animToAnimIdleCFTimeFinal = soldAnimObj.animation[selectedDamageAnim].length - passedAnimTime;
                step = StepEnum.AnimToIdle02;
                goto Start;
            }
        }
        #endregion

        #region Idle
        if (step == StepEnum.Idle)
        {
            if (needsToBeFinished)
            {
                SetFinished(true);
                return;
            }

            if (soldInfo.isDamageRecievedInThisRun)
            {
                dmg = soldInfo.firstDamage;

                if (ShouldTakeDamage(dmg))
                {
                    step = StepEnum.Damage01;
                    goto Start;
                }
            }

            float animTime = soldAnimObj.animation[selectedAnim].time;

            if (animTime >= soldAnimObj.animation[selectedAnim].length - animToAnimIdleCrossfadeTime)
            {
                animToAnimIdleCFTimeFinal = soldAnimObj.animation[selectedAnim].length - animTime;
                step = StepEnum.AnimToIdle02;
                goto Start;
            }
        }
        #endregion

Finish:
        return;
    }
Пример #9
0
 public override void StartAct()
 {
     base.StartAct();
     step = StepEnum.AnimToIdle01;
 }
Пример #10
0
 public UpdateException(StepEnum onStep, string message) : base(message)
 {
     this.step = onStep;
 }
Пример #11
0
    public void UpdateAct()
    {
Start:

        #region Start01
        if (step == StepEnum.Start01)
        {
            curCurveInfoIndex = 0;
            step = StepEnum.UseCurves01;
        }
        #endregion

        #region UseCurves01
        if (step == StepEnum.UseCurves01)
        {
            curCurveInfo                  = curveInfos[curCurveInfoIndex];
            curAntaresCurve               = curCurveInfo.curve;
            selectedAnim                  = curCurveInfo.animsList.GetRandomAnimName();
            curCurveCFTime                = curCurveInfo.crossfadeTime;
            curCurveMaxSpeed              = curCurveInfo.speed;
            curCurvePointToStay           = curCurveInfo.pointToStay;
            curCurveEndMinSpeed           = curCurveInfo.endMinSpeed;
            curCurveEndLengthToDecSpeed   = curCurveInfo.endLengthToStartDecreasingSpeed;
            curCurve_SpeedInc_Speed       = curCurveInfo.speedInc_Speed;
            curCurve_SpeedDec_Speed       = curCurveInfo.speedDec_Speed;
            curCurvePointStayTime         = curCurveInfo.pointStayTime;
            curCurveEndLengthToChangeAnim = curCurveInfo.endLengthToChangeAnim;

            curCurveDelayCoefForStartAnimation_Min = curCurveInfo.delayCoefForStartAnimation_Min;
            curCurveDelayCoefForStartAnimation_Max = curCurveInfo.delayCoefForStartAnimation_Max;

            nextCurveInfoIndex = GetNextCurveInfoIndex();


            curCurveInfoCounter = 0;
            curCurve_CurSpeed   = 0;

            if (!nextAnimIsRanBefore)
            {
                StartNewMainAnimWithCrossfadeTime(selectedAnim, curCurveCFTime, curCurveDelayCoefForStartAnimation_Min,
                                                  curCurveDelayCoefForStartAnimation_Max);
            }

            nextAnimIsRanBefore = false;
            nextAnim            = "";
            nextAnimCFTime      = 0;

            isFirstTickOnCurveInfo = true;

            step = StepEnum.UseCurves02;
        }
        #endregion

        #region UseCurves02
        if (step == StepEnum.UseCurves02)
        {
            if (curCurvePointToStay)
            {
                IncreasePointStayTimeCounter();

                SetPosAndRotByStayPoint();

                CheckIfNeedsStartNextAnimInStayMode();

                if (IsPointStayTimeFinished())
                {
                    step = StepEnum.UseCurves03;
                    goto Finish;
                }
            }
            else
            {
                if (IsSoldierReachedToTheEndMinSpeedArea())
                {
                    DecCurveInfoCurrentSpeedForEnd();
                }
                else
                {
                    IncCurveInfoCurrentSpeed();
                }

                IncreaseCurCurveCounterByCurrentSpeed();

                SetPosAndRotByCurCurve();

                CheckIfNeedsStartNextAnimInCurveMode();

                if (IsCurveCounterReachedToEnd())
                {
                    step = StepEnum.UseCurves03;
                    goto Start;
                }
            }

            isFirstTickOnCurveInfo = false;
        }
        #endregion

        #region UseCurves03
        if (step == StepEnum.UseCurves03)
        {
            curCurveInfoIndex = nextCurveInfoIndex;

            step = StepEnum.UseCurves01;
            goto Start;
        }
        #endregion

Finish:
        return;
    }
Пример #12
0
    public void StartAct()
    {
        step = StepEnum.Start01;

        shouldUpdateAct = true;
    }
Пример #13
0
 /// <summary>
 /// Fire the update event
 /// </summary>
 /// <param name="step"></param>
 /// <param name="message"></param>
 private void FireEvent(StepEnum step, string message)
 {
     this.updateProcessedHandler?.Invoke(step, message);
 }