void SetPosAndRotByCurCurve() { if (!GameController.isGamePaused && Time.deltaTime != 0) { Vector3 interpolatedPoint = curAntaresCurve.GetInterpolatedPoint(curCurveInfoCounter); Vector3 destRot = interpolatedPoint - controlledSoldier.position; if (IsCurveCounterReachedToEnd()) { Vector3 endInterPoint = curAntaresCurve.GetInterpolatedPoint(curCurveInfoCounter + curveThreshold); destRot = endInterPoint - controlledSoldier.position; } float deltaAngle = Mathf.DeltaAngle( MathfPlus.HorizontalAngle(controlledSoldier.forward), MathfPlus.HorizontalAngle(destRot)); float rotAmount = deltaAngle; Quaternion rotVec = Quaternion.Euler(0, rotAmount, 0); if (!isFirstTickOnCurveInfo) { controlledSoldier.rotation *= rotVec; } //controlledSoldier.position = new Vector3(interpolatedPoint.x, controlledSoldier.position.y, interpolatedPoint.z); controlledSoldier.position = new Vector3(interpolatedPoint.x, GetGroundY(), interpolatedPoint.z); } }
// Update is called once per frame void Update() { keyCheckCounter = MathfPlus.DecByDeltatimeToZero(keyCheckCounter); if (keyCheckCounter == 0) { if (waitingForKey) { if (CustomInputManager.IsAnyKeyDown() || shouldLoadImmediately) { StartLoadingLevel(); } } } float scWbbH = ((float)(Screen.width)) / ((float)(Screen.height)); //print(scWbbH); if (scWbbH < scWbbHIn16b9) { float moreX = (scWbbHIn16b9 - scWbbH) * xDiffIn16b9And5b4; storyPageText.transform.position = new Vector3(storyPageTextOriginalX + moreX, storyPageText.transform.position.y, storyPageText.transform.position.z); } }
void Update() { timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter); delayTimeToEnableCollider = MathfPlus.DecByDeltatimeToZero(delayTimeToEnableCollider); if (timeCounter <= time - minTimeBeforeConsideringHit) { if (isHitted) { if (timeCounter <= hitStartingTime - explosionTimeAfterFirstHit) { Explode(); return; } } } if (timeCounter == 0) { Explode(); return; } if (delayTimeToEnableCollider == 0) { delayTimeToEnableCollider = 1000000; Collider col = GetComponent <Collider>(); if (!col.enabled) { col.enabled = true; } } }
void Update() { if (groupDelayCounter > 0) { groupDelayCounter = MathfPlus.DecByDeltatimeToZero(groupDelayCounter); } }
// void Update() { if (started) { delayCounter = MathfPlus.DecByDeltatimeToZero(delayCounter); if (delayCounter == 0) { nowKill = true; started = false; shouldCountStop = true; } } if (shouldCountStop) { stopTimeCounter = MathfPlus.DecByDeltatimeToZero(stopTimeCounter); if (stopTimeCounter == 0) { nowKill = false; shouldCountStop = false; } } }
void Update() { if (status == ActionStatus.Running) { if (!firstInitIsDone) { delay = MathfPlus.DecByDeltatimeToZero(delay); if (delay == 0) { firstInitIsDone = true; for (int i = 0; i < playerRenderAreas.Length; i++) { playerRenderAreas[i].HideSoldiers(); } indexOfCurRelationAreaThatPlayerIsIn = GetIndexOfAreaThatPlayerIsIn(); if (indexOfCurRelationAreaThatPlayerIsIn >= 0) { playerRenderAreas[indexOfCurRelationAreaThatPlayerIsIn].ShowSoldiers(); } } } else { CheckAndInitIndices(); } } }
void Update() { if (step == 1) { int rnd = Random.Range(0, mortarManagers.Length); selectedMrtMg = mortarManagers[rnd]; selectedMrtMg.StartItIfNotStarted(); SetStep(2); } if (step == 2) { if (selectedMrtMg.IsReady()) { timer = maxTimeOfWaitingForNextExplosion; SetStep(3); } } if (step == 3) { timer = MathfPlus.DecByDeltatimeToZero(timer); if (timer == 0) { SetStep(1); } } }
void FixedUpdate() { if (isEnabled) { if (isEnabledFirstTick) { enabledFixedUpdateCount++; if (enabledFixedUpdateCount == 30) { isEnabledFirstTick = false; } } time_InObjectsGarbageRemove_Counter = MathfPlus.DecByDeltatimeToZero(time_InObjectsGarbageRemove_Counter); if (time_InObjectsGarbageRemove_Counter == 0) { time_InObjectsGarbageRemove_Counter = time_InObjectsGarbageRemove_Max; int i = 0; while (i < objectsIn.Count) { if (objectsIn[i] == null) { objectsIn.RemoveAt(i); continue; } i++; } } } }
void Update() { curAudioTimeCounter = MathfPlus.DecByDeltatimeToZero(audioSource.pitch); isPlaying = audioSource.isPlaying; time = audioSource.time; if (shouldDecreaseVolumeToEnd) { SetCustomVolume(customVolume - (Time.deltaTime / decreasingCustomVolumeTime)); if (customVolume == 0) { shouldDecreaseVolumeToEnd = false; } } if (isItADeadAudioInfo) { if (!isGamePaused && !isPlaying) { Destroy(this.gameObject); } } }
public Vector3 RoadCenterAt(float distanceFromStart, out bool done, out Vector3 direction) { var segments = Math.Round(CachedNodes.Length * 100 * SegmentRate); var nodePositions = CachedNodes.Select(x => x.transform.localPosition).ToArray(); float lengthSeen = 0; for (int i = 0; i <= segments; i++) { var s = i / (float)segments; var center = MathfPlus.BSpline(nodePositions, s); Vector3 nextCenter = MathfPlus.BSpline(nodePositions, (i + 1) / (float)segments); direction = nextCenter - center; var segmentLength = Vector3.Distance(nextCenter, center); lengthSeen += segmentLength; if (lengthSeen > distanceFromStart) { float distanceAtLastSegment = lengthSeen - segmentLength; done = false; return(transform.localToWorldMatrix * MathfPlus.PadVector3(Vector3.Lerp(center, nextCenter, (distanceFromStart - distanceAtLastSegment) / (lengthSeen - distanceAtLastSegment)))); } } // fallback : at distance = 0 done = true; direction = Vector3.zero; return(Vector3.zero); }
void Update() { if (isPlaying) { timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter); if (timeCounter == 0) { if (nextIndex >= audioClips.Length) { isPlaying = false; } else { timeCounter = audioClipTimes[nextIndex]; if (audioClips[nextIndex] != null) { audioInfo.PlayClip(audioClips[nextIndex]); } nextIndex++; } } } }
//Pre void DoPre_FightInPoint() { //timeToGoToClosePoint_Counter = MathfPlus.DecByDeltatimeToZero(timeToGoToClosePoint_Counter); timeToCheckAvailableTargets_Counter = MathfPlus.DecByDeltatimeToZero(timeToCheckAvailableTargets_Counter); time_ChangePoint_Counter = MathfPlus.DecByDeltatimeToZero(time_ChangePoint_Counter); }
public override void RunIt() { base.RunIt(); if (levelStep < 0) { missionFailCounter = MathfPlus.DecByDeltatimeToZero(missionFailCounter); } #region -1: Mission failed by not supporting allies if (levelStep == step_MissionFail_AlliesNotSupported) { IfItsOkSetMissionFailed(MissionFailType.AlliesNotSupported); } #endregion #region -2: Mission failed by leaving fight area if (levelStep == step_MissionFail_YouLeftFightArea) { IfItsOkSetMissionFailed(MissionFailType.YouLeftFightArea); } #endregion #region -3: Mission failed. You are detected by enemies. if (levelStep == step_MissionFail_YouAreDetectedByEnemies) { IfItsOkSetMissionFailed(MissionFailType.YouAreDetectedByEnemies); } #endregion #region -4: Mission failed. You left area without planting dynamites. if (levelStep == step_MissionFail_YouLeftAreaWithoutPlantingDynamites) { IfItsOkSetMissionFailed(MissionFailType.YouLeftAreaWithoutPlantingDynamites); } #endregion #region -5: Mission failed. Dynamte Has Been Exploded Before Communication Breakdown. if (levelStep == step_MissionFail_DynamteHasBeenExplodedBeforeCommunicationBreakdown) { IfItsOkSetMissionFailed(MissionFailType.DynamteHasBeenExplodedBeforeCommunicationBreakdown); } #endregion #region -6: Mission failed. Enemy Heard Your Fire. if (levelStep == step_MissionFail_EnemyHeardYourFire) { IfItsOkSetMissionFailed(MissionFailType.EnemyHeardYourFire); } #endregion #region -7: Mission failed. Enemy Saw His Mate Nash. if (levelStep == step_MissionFail_EnemySawHisMateNash) { IfItsOkSetMissionFailed(MissionFailType.EnemySawHisMateNash); } #endregion }
public static float GetDeltaAngle(Vector3 _sourceForwardVec, Vector3 _sourcePos, Vector3 _targetPos) { Vector3 destForwardVec = _targetPos - _sourcePos; float deltaAngle = Mathf.DeltaAngle( MathfPlus.HorizontalAngle(_sourceForwardVec), MathfPlus.HorizontalAngle(destForwardVec)); return(deltaAngle); }
float GetAngleToTarget() { if (!mapLogic.IsCharacterTotallyFightable(target.character)) { return(0); } return(MathfPlus.GetDeltaAngle(machineGun.transform.forward, machineGun.transform.position, target.character.transform.position)); }
void SlowlyTrySetAChildFightRegGrenade() { childGrenadeCheckTimeCounter = MathfPlus.DecByDeltatimeToZero(childGrenadeCheckTimeCounter); if (childGrenadeCheckTimeCounter == 0) { childGrenadeCheckTimeCounter = childGrenadeCheckMaxTime; TrySetAChildFightRegGrenade(); } }
// Update is called once per frame void Update() { ctr = MathfPlus.DecByDeltatimeToZero(ctr); if (ctr == 0) { Instantiate(objToCreate, transform.position, transform.rotation); ctr = maxTime; } }
// Update is called once per frame void Update() { timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter); if (timeCounter == 0) { timeCounter = 100000000; EnableZakhmiAllyPack(); } }
public static Vector3 GetShootingRaycastPos(Vector3 _basePos, Quaternion _baseRot, Vector3 _offset) { Vector3 pos = _basePos; Quaternion rot = _baseRot; Vector3 offs = _offset; offs = MathfPlus.RotateVecAroundYAxisByRotation(offs, rot); offs += pos; return(offs); }
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))); }
void Update() { time_RefreshingTargettingEnemies_Counter = MathfPlus.DecByDeltatimeToZero(time_RefreshingTargettingEnemies_Counter); if (time_RefreshingTargettingEnemies_Counter == 0) { time_RefreshingTargettingEnemies_Counter = time_RefreshingTargettingEnemies_Max; RefreshTargettingEnemiesStats(); } }
void Update() { if (isEnabled) { timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter); if (timeCounter == 0) { EndIt(); return; } checkPlayerInTimeCounter = MathfPlus.DecByDeltatimeToZero(checkPlayerInTimeCounter); if (checkPlayerInTimeCounter == 0) { IsPlayerIn = false; } if (IsPlayerIn) { countPlayerStayTime = true; } else { countPlayerStayTime = false; playerStayingTime = 0; } if (countPlayerStayTime) { playerStayingTime += Time.deltaTime; if (playerStayingTime > delayTimeToKillPlayer) { if (IsPlayerIn) { bool isOK = false; if (GetNumOfInsideEnemies() > skippabaleNumOfInsideAliveSolds) { isOK = true; } if (isOK) { KillPlayer(); EndIt(); } } } } } }
// Update is called once per frame void Update() { if (delayCounter > 0) { delayCounter = MathfPlus.DecByDeltatimeToZero(delayCounter); if (delayCounter == 0) { animation[animation.clip.name].time = time; } } }
void Update() { if (khalooGunParticleCounter > 0) { khalooGunParticleCounter = MathfPlus.DecByDeltatimeToZero(khalooGunParticleCounter); if (khalooGunParticleCounter == 0) { khalooGunFireParticle.GetComponent <ParticleSystem>().Stop(); khalooGunFireParticle.SetActiveRecursively(false); } } }
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 }
// void Update() { #region Show For A While if (showForAWhile_Step == ShowForAWhileStep.FirstAlpha) { StartIncreasingAlpha(showForAWhile_StartingAlphaSpeed); showForAWhile_Step = ShowForAWhileStep.Showing; } if (showForAWhile_Step == ShowForAWhileStep.Showing) { showForAWhile_DurationCounter = MathfPlus.DecByDeltatimeToZero(showForAWhile_DurationCounter); if (showForAWhile_DurationCounter == 0) { StartDecreasingAlpha(showForAWhile_EndAlphaSpeed); showForAWhile_Step = ShowForAWhileStep.EndAlpha; } } if (showForAWhile_Step == ShowForAWhileStep.EndAlpha) { if (alpha == 0) { showForAWhile_Step = ShowForAWhileStep.Idle; } } #endregion #region Alpha if (alphaStatus == HUDAlphaStat.Increasing) { SetAlpha(alpha + alphaChangeSpeed * Time.deltaTime); if (alphaStatus == HUDAlphaStat.Mid) { alphaStatus = HUDAlphaStat.Increasing; } } if (alphaStatus == HUDAlphaStat.Decreasing) { SetAlpha(alpha - alphaChangeSpeed * Time.deltaTime); if (alphaStatus == HUDAlphaStat.Mid) { alphaStatus = HUDAlphaStat.Decreasing; } } #endregion }
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; } } }
// void Update() { #region PassingDelay if (IsStatus(MusicPlayingStatus.PassingDelay)) { newSongStartDelay = MathfPlus.DecByDeltatimeToZero(newSongStartDelay); if (newSongStartDelay == 0) { MapLogic.Instance.audioInfo_Music.SetCustomVolume(1); MapLogic.Instance.audioInfo_Music.PlayClip(GetAudioClipBySongType(curPlayingSong)); SetStatus(MusicPlayingStatus.Playing); } } #endregion #region FadingToNewMusic if (IsStatus(MusicPlayingStatus.FadingToNewMusic)) { MapLogic.Instance.audioInfo_Music.SetCustomVolume(MapLogic.Instance.audioInfo_Music.customVolume - Time.deltaTime * curFadeSpeed); if (MapLogic.Instance.audioInfo_Music.customVolume == 0) { curPlayingSong = queuedSong; queuedSong = MusicSong.None; SetStatus(MusicPlayingStatus.PassingDelay); } } #endregion #region FadingToNone if (IsStatus(MusicPlayingStatus.FadingToNone)) { MapLogic.Instance.audioInfo_Music.SetCustomVolume(MapLogic.Instance.audioInfo_Music.customVolume - Time.deltaTime * curFadeSpeed); if (MapLogic.Instance.audioInfo_Music.customVolume == 0) { curPlayingSong = MusicSong.None; MapLogic.Instance.audioInfo_Music.Stop(); SetStatus(MusicPlayingStatus.Idle); } } #endregion }
public override void RunIt() { base.RunIt(); if (step == 1) { if (needsToBeFinished) { if (!soldInfo.IsVoiceOnBusyTimer()) { SetFinished(false); return; } } if (startDelayTime > 0) { startDelayTime = MathfPlus.DecByDeltatimeToZero(startDelayTime); } if (startDelayTime == 0) { if (!soldInfo.IsVoiceOnBusyTimer()) { soldInfo.PlayVoiceWithAdditionalBusyTime(audioClips, time_Delay_Min, time_Delay_Max); if (setDoneAfterOneTalk) { timeCounter = soldInfo.voiceBusyTimeCounter; step = 2; } return; } } } if (step == 2) { timeCounter = MathfPlus.DecByDeltatimeToZero(timeCounter); if (timeCounter == 0) { SetFinished(true); return; } } }
// Update is called once per frame void Update() { if (status == ActionStatus.NotStarted) { delayToStart = MathfPlus.DecByDeltatimeToZero(delayToStart); if (delayToStart == 0) { status = ActionStatus.Running; } } if (status == ActionStatus.Running) { if (logTrig.IsPlayerIn()) { if (!myRainsAreActive) { myRainsAreActive = true; playerCharNew.campRain.emit = false; foreach (ParticleEmitter pe in rains) { pe.emit = true; } } } else { if (myRainsAreActive) { myRainsAreActive = false; playerCharNew.campRain.emit = true; foreach (ParticleEmitter pe in rains) { pe.emit = false; } } } } }