Exemplo n.º 1
0
    void DecPlayerDectectionCounter()
    {
        float viewRange = mapLogic.camp_CurUpdate_SoldsViewRange;

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

        distToPlayer = Mathf.Clamp(distToPlayer, 0, viewRange);

        playerDetectionCounter = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(playerDetectionCounter, playerDetectionTimeCounterBaseSpeed + (playerDetectionTimeMaxCoef - 1) * (1 - (distToPlayer / viewRange)));
    }
Exemplo n.º 2
0
    void Update()
    {
        curFireTime = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(curFireTime, curFireTimeDecreasementAdditionalCoef);

        #region Dispersion Angle

        #region By Movement
        if (isPlayerOnAir)
        {
            if (totalDispAng <= dispersionAngle_Noraml_Max && !needToDecreaseDispersionOnAir)
            {
                totalDispAng += GetDispersionAngleWhenPlayerBeOnAir();

                if (totalDispAng > dispersionAngle_Noraml_Max)
                {
                    needToDecreaseDispersionOnAir = true;
                }
            }
            else
            {
                if (GetDispersionAngleByPlayerMovementSpeed() == 0)
                {
                    totalDispAng = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(totalDispAng, dispersionAngleDecSpeedWhenOnAir);
                }
            }
        }
        else
        {
            totalDispAng += GetDispersionAngleByPlayerMovementSpeed();

            if (GetDispersionAngleByPlayerMovementSpeed() == 0)
            {
                totalDispAng = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(totalDispAng, dispersionAngleDecSpeed);
            }

            needToDecreaseDispersionOnAir = false;
        }
        #endregion

        #region By Shooting
        totalDispAng += dispersionAngleFromShooting;

        dispersionAngleFromShooting = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(dispersionAngleFromShooting, dispersionAngleDecSpeed);
        #endregion

        totalDispAng = ClampTotalDispersionAngle(totalDispAng);

        SetCurrentDispersionAngle(totalDispAng);

        #endregion
    }
Exemplo n.º 3
0
    void Update()
    {
        if (isSwitchingAnims)
        {
            camera.animation[animMain.name].weight = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(camera.animation[animMain.name].weight, switchingAnimSpeed);

            camera.animation[animEnd.name].weight = 1 - camera.animation[animMain.name].weight;

            if (camera.animation[animEnd.name].weight == 1)
            {
                isSwitchingAnims = false;
            }
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (status == ActionStatus.Running)
        {
            if (sourceTr != null)
            {
                transform.position = sourceTr.position;
                transform.LookAt(playerCharNew.fpsCamera.transform);

                lastPos = transform.position;

                float distToPlayer = Vector3.Distance(transform.position, playerCharNew.transform.position);

                float newScale = distToPlayer / (scaling_MaxDist - scaling_MinDist);
                newScale = Mathf.Clamp(newScale, minScale, maxScale);

                datRenderObj.transform.localScale = new Vector3(newScale, newScale, newScale);

                alpha = (distToPlayer - MaxDistForFullAlpha) / (DistForZeroAlpha - MaxDistForFullAlpha);
                alpha = Mathf.Clamp01(alpha);
                alpha = 1 - alpha;

                Color col = datRenderObj.material.color;
                datRenderObj.material.color = new Color(col.r, col.g, col.b, alpha);
            }
            else
            {
                StopIt();
            }
        }

        if (status == ActionStatus.Finished)
        {
            if (alpha > 0)
            {
                alpha = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(alpha, alphaDecSpeed);

                Color col = datRenderObj.material.color;
                datRenderObj.material.color = new Color(col.r, col.g, col.b, alpha);
            }
        }

        if (alpha > 0)
        {
            switch (dem3DObjType)
            {
            case The3DObjIconType.FeleshRooBePayin:
                counter           += Time.deltaTime * yMoveSpeed;
                transform.position = new Vector3(lastPos.x, lastPos.y - Mathf.Sin(counter) * yMaxMoveDist, lastPos.z);
                break;

            case The3DObjIconType.FeleshRooBeBala:
                counter           += Time.deltaTime * yMoveSpeed;
                transform.position = new Vector3(lastPos.x, lastPos.y + Mathf.Sin(counter) * yMaxMoveDist, lastPos.z);
                break;

            case The3DObjIconType.Dot:
                counter += Time.deltaTime * scaleChangeSpeed;
                float datAmount = Mathf.Sin(counter) * scaleMaxAmount;
                transform.localScale = new Vector3(1, 1, 1) + new Vector3(datAmount, datAmount, datAmount);
                break;
            }
        }
    }
Exemplo n.º 5
0
 // Update is called once per frame
 void Update()
 {
     alpha = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(alpha, alphaDecSpeed);
     renderer.material.color = new Color(initialColor.r, initialColor.g, initialColor.b, alpha);
 }
Exemplo n.º 6
0
    void Update()
    {
        #region Start
        if (step == 0)
        {
            timeCounter = step01_Driving_Time;

            step = 1;
        }
        #endregion

        #region Step01 Driving
        if (step == 1)
        {
            timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter);

            if (!isWoodDropSoundPlayed)
            {
                if (timeCounter < (step01_Driving_Time - timeToPlayWoodDrop))
                {
                    isWoodDropSoundPlayed = true;
                    woodDropAudInfo.Play();
                }
            }

            if (timeCounter == 0)
            {
                step = 2;
            }
        }
        #endregion

        #region Step02 Dezhbani
        if (step == 2)
        {
            timeCounter = step02_Dezhabni;

            step = 2.1f;
        }
        #endregion

        #region Step 2.1
        if (step == 2.1f)
        {
            timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter);

            #region AnimsWeight FirstDecreasement
            if ((timeCounter < (step02_Dezhabni - timeToDecAnimsWeight)) && (timeCounter >= (step02_Dezhabni - timeToIncAnimsWeightAgain)))
            {
                foreach (Animation ani in animsToChangeWeight)
                {
                    ani[ani.clip.name].weight = MathfPlus.DecByDeltatimeToZeroWithAdditionalCoef(ani[ani.clip.name].weight, animsWeightIncDecSpeed);
                }
            }
            #endregion

            #region AnimsWeight LastIncreasement
            if (timeCounter < (step02_Dezhabni - timeToIncAnimsWeightAgain))
            {
                foreach (Animation ani in animsToChangeWeight)
                {
                    ani[ani.clip.name].weight += Time.deltaTime * animsWeightIncDecSpeed;
                    ani[ani.clip.name].weight  = Mathf.Clamp01(ani[ani.clip.name].weight);
                }
            }
            #endregion

            #region Soldier Start
            if (!isSoldierRun)
            {
                if (timeCounter < (step02_Dezhabni - timeToRunSoldier))
                {
                    isSoldierRun = true;

                    soldier.SetActiveRecursively(true);
                    soldierLight.active = false;
                    soldier.animation.Play();
                }
            }
            #endregion

            #region Soldier End
            if (!isSoldierStopped)
            {
                if (timeCounter < (step02_Dezhabni - timeToEndSoldier))
                {
                    isSoldierStopped = true;

                    soldier.transform.position = new Vector3(1000, 1000, 1000);
                }
            }
            #endregion

            #region SoldierLight Start
            if (!isSoldierLightStarted)
            {
                if (timeCounter < (step02_Dezhabni - timeToStartSoldierLight))
                {
                    isSoldierLightStarted = true;

                    soldierLight.active = true;
                }
            }
            #endregion

            #region SoldierLight End
            if (!isSoldierLightStopped)
            {
                if (timeCounter < (step02_Dezhabni - timeToEndSoldierLight))
                {
                    isSoldierLightStopped = true;

                    soldierLight.active = false;
                }
            }
            #endregion

            #region PlayerAnim Start
            if (!isPlayerAnimStarted)
            {
                if (timeCounter < (step02_Dezhabni - timeToStartPlayerAnim))
                {
                    isPlayerAnimStarted = true;

                    palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].enabled = true;
                    palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight  = 0;
                }
            }
            #endregion

            #region PlayerAnim Run
            if (isPlayerAnimStarted && (timeCounter >= (step02_Dezhabni - timeToEndPlayerAnim)))
            {
                palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight += Time.deltaTime * animPlayerWeightIncDecSpeed;
                palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight  = Mathf.Clamp01(palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight);
            }
            #endregion

            #region PlayerAnim End
            if (!isPlayerAnimFinished)
            {
                if (timeCounter < (step02_Dezhabni - timeToEndPlayerAnim))
                {
                    palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight -= Time.deltaTime * animPlayerWeightIncDecSpeed;
                    palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight  = Mathf.Clamp01(palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight);

                    if (palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].weight == 0)
                    {
                        palyerObjectForFearAnim.animation[palyerObjectForFearAnim.animation.clip.name].enabled = false;
                        //palyerCameraToSlerp.GetComponent<MouseLook>().enabled = true;
                        palyerCameraToSlerp.GetComponent <TruckMapMouseLook>().RestartIt();
                        CustomInputManager.ResetInputAxes();
                        isPlayerAnimFinished = true;
                    }
                }
            }
            #endregion

            #region PlayerRotateLerp (All)
            if ((timeCounter < (step02_Dezhabni - timeToStartPlayerRotateLerp)) && timeCounter >= (step02_Dezhabni - timeToStopPlayerRotateLerp))
            {
                //palyerCameraToSlerp.GetComponent<MouseLook>().enabled = false;

                palyerCameraToSlerp.GetComponent <TruckMapMouseLook>().DisableIt();
                Quaternion toQuat = Quaternion.Euler(new Vector3(0, 270, 0));
                palyerCameraToSlerp.transform.localRotation = Quaternion.Slerp(palyerCameraToSlerp.transform.localRotation, toQuat, playerRotateLerpSpeed * Time.deltaTime);
            }
            #endregion

            #region AudiosVol FirstDecreasement
            if ((timeCounter < (step02_Dezhabni - timeToDecAudiosVolume)) && (timeCounter >= (step02_Dezhabni - timeToIncAudiosVolumeAgain)))
            {
                foreach (AudioInfo aud in audioInfosToChangeVolume)
                {
                    aud.SetCustomVolume(aud.customVolume - Time.deltaTime * audioDecIncSpeed);
                }
            }
            #endregion

            #region AudiosVol LastIncreasement
            if (timeCounter < (step02_Dezhabni - timeToIncAudiosVolumeAgain))
            {
                foreach (AudioInfo aud in audioInfosToChangeVolume)
                {
                    aud.SetCustomVolume(aud.customVolume + Time.deltaTime * audioDecIncSpeed);
                }
            }
            #endregion

            if (timeCounter == 0)
            {
                step = 3;
            }
        }
        #endregion

        #region 3 Start screen fading
        if (step == 3f)
        {
            MapLogic.Instance.blackScreenFader.StartFadingOut();

            step = 3.1f;
        }
        #endregion

        #region 3.1 W8 for finish
        if (step == 3.1f)
        {
            if (MapLogic.Instance.blackScreenFader.isFadingFinished)
            {
                SetMissionIsFinished();
                step = 4;
            }
        }
        #endregion
    }