void Update() { switch(timeState) { case TimeState.Normal: Time.timeScale = 1.0f; break; case TimeState.Slowed: StartCoroutine(SlowdownTime()); timeState = TimeState.Speeding; break; case TimeState.Slowing: while(Time.timeScale - targetScale > 0.001f) Time.timeScale = Mathf.Lerp(Time.timeScale, targetScale, warpSpeed); timeState = TimeState.Slowed; break; case TimeState.Speeding: while(1.0f - Time.timeScale > 0.001f) Time.timeScale = Mathf.Lerp(Time.timeScale, 1.0f, warpSpeed); timeState = TimeState.Normal; break; default: break; } print (Time.timeScale); //smooth out the framerate during the slowdown Time.fixedDeltaTime = Time.timeScale * 0.02f; }
/// <summary> /// (协程)白天到黑夜 /// </summary> /// <param name="per"></param> /// <returns></returns> public IEnumerator DayToNight(float per) { for (float i = daySprt[0].color.a; curTime == TimeState.Day; i -= per) { //每次必然是遍历了一遍的,所以取值只要开头的,终止判断只要最后的。 //减弱 for (int imask = 0; imask < GreenMask.Count; imask++) { GreenMask[imask].color = GreenMask[imask].color - new Color(0, 0, 0, per * 2); } //减弱 for (int index = 0; index < daySprt.Count; index++) { daySprt[index].color = new Color(daySprt[index].color.r, daySprt[index].color.g, daySprt[index].color.b, i); } //加强 for (int index = 0; index < nightSprt.Count; index++) { if (nightSprt[index].gameObject.tag.Equals("Light")) { nightSprt[index].color = new Color(nightSprt[index].color.r, nightSprt[index].color.g, nightSprt[index].color.b, nightLightIntensity[index] - i); continue; } nightSprt[index].color = new Color(nightSprt[index].color.r, nightSprt[index].color.g, nightSprt[index].color.b, 1 - i); } //加强 for (int imask = 0; imask < BlueMask.Count; imask++) { //如果Alpha的值小于完全值,则加强 if (BlueMask[imask].color.a <= BlueAlpha[imask]) { BlueMask[imask].color = BlueMask[imask].color + new Color(0, 0, 0, per * 2); } } //如果放开改变时间的按钮 //if (!isChanging) //{ // ChangeTimeLock = false; // yield break; //} if (daySprt[daySprt.Count - 1].color.a <= 0) { curTime = TimeState.Night; } yield return(null); } ChangeTimeLock = false; //释放锁 isChanging = false; }
public void progressTimeState() { switch (currentTimeState) { case TimeState.Morning: lightingObjects[0].SetActive(false); lightingObjects[1].SetActive(true); currentTimeState = TimeState.Lunch; transitionManager.makeTransition(Transition.Lunch); break; case TimeState.Lunch: lightingObjects[1].SetActive(false); lightingObjects[2].SetActive(true); currentTimeState = TimeState.Afternoon; transitionManager.makeTransition(Transition.Afternoon); break; case TimeState.Afternoon: lightingObjects[2].SetActive(false); lightingObjects[3].SetActive(true); currentTimeState = TimeState.DateSelection; transitionManager.makeTransition(Transition.DateSelection); break; case TimeState.DateSelection: if (isLastDay()) { currentTimeState = TimeState.End; transitionManager.makeTransition(Transition.Ending, 0); } else { currentTimeState = TimeState.Date; transitionManager.makeTransition(Transition.Date); } setUpDateGameObjects(); break; case TimeState.Date: lightingObjects[3].SetActive(false); lightingObjects[0].SetActive(true); currentTimeState = TimeState.Morning; cleanUpDateGameObjects(); advancetoNextDay(); break; } }
public void RewindTime(int customRewindSpeed = -1) { if (customRewindSpeed == -1) { currentRewindSpeed = RewindSpeed; } else { currentRewindSpeed = customRewindSpeed; } ApplyToEveryInstance((timeInteractable) => { timeInteractable.RewindTime(currentRewindSpeed); }); timeState = TimeState.Rewind; }
public void SlowTime(int customSlowFactor = -1) { if (customSlowFactor == -1) { currentSlowFactor = SlowTimeFactor; } else { currentSlowFactor = customSlowFactor; } ApplyToEveryInstance((timeInteractable) => { timeInteractable.SlowTime(currentSlowFactor); }); timeState = TimeState.Slow; }
private void PerformSwap() { m_PerformingSwap = false; Time.timeScale = 1f; Time.fixedDeltaTime = 0.02F * Time.timeScale; CurrentState = CurrentState == TimeState.PAST ? TimeState.FUTURE : TimeState.PAST; OnTimeSwap(); if (!m_FirstSwapDone) { m_FirstSwapDone = true; DialogueController.Instance.StartDialogue(DialogueEvent.FIRST_WARP); } }
public void Time_Record_Play() { Physics.autoSimulation = false; if (state == TimeState.None) { state = TimeState.Freeze; foreach (var u in units) { u.Record_Play(); } onRecordPlay.Invoke(); } state = TimeState.Freeze; }
public static void ChangeState(TimeState newState) { //singleton.state = newState; if (newState == TimeState.Slow) { Time.timeScale = singleton.slowScale; } else if (newState == TimeState.Normal) { Time.timeScale = singleton.normalScale; } Time.fixedDeltaTime = 0.02f * Time.timeScale; }
public void Time_Direction(float dir) { if (dir > 0) { state = TimeState.Flow; } else if (dir < 0) { state = TimeState.Rewind; } else { state = TimeState.Freeze; } }
public void Closed(TimeState ts) { if (ts == TimeState.Past && past.SpriteSheet.Name.ToLower().Contains("door")) { past = pastClosed; pastCollidable = true; open = false; } else if (future.SpriteSheet.Name.ToLower().Contains("door")) { future = futureClosed; futureCollidable = true; open = false; } }
public static void FastForwardStep() { State = TimeState.FastForward; if (!Running) { return; } timeGame++; SafeSetPixel(timeGame, getLoopUniverse(Universe * 5), FastForwardColor); LastState = State; }
private void timeWindow(int windowID) { GUILayout.Label("Set Time:"); foreach (var en in Enum.GetValues(typeof(TimeState))) { TimeState e = (TimeState)en; if (GUILayout.Button(e.ToString())) { SetTime(e); } } GUI.DragWindow(); }
// 시간 되돌리기 public void ReverseTime( TimeState beforeTS, TimeState dbBeforeTS, float linear, GameObject target, Components components ) { Vector2 vec2 = Vector2.Lerp( dbBeforeTS.TObjectSt.Position, beforeTS.TObjectSt.Position, linear); target.transform.position = vec2; }
void CheckForNightTime() { //Has our day ended? if (FL_actionPointsUsed >= FL_actionPointsAvailable) { FL_actionPointsUsed = FL_actionPointsAvailable; FL_morning = FL_actionPointsAvailable * FL_dayHours / FL_workHours; FL_time = FL_actionPointsAvailable; BL_pause = true; BL_playerControlledEvent = false; State = TimeState.Nighttime; } }
private void SlowTimeInternal() { switch (_currentState) { case TimeState.Stopping: break; case TimeState.Slow: _nextStateChange = Time.time + _slowHoldDuration; break; default: _currentState = TimeState.Stopping; _nextStateChange = Time.time + _slowDownDuration; break; } }
public override void TimeStateChange(TimeState old, TimeState nu) { if (nu == TimeState.Normal) { GetComponent <NavMeshAgent>().Resume(); } if (old != TimeState.Normal && nu == TimeState.Normal) { GetComponent <NavMeshAgent>().velocity = lastVelocity; } if (nu != TimeState.Normal) { GetComponent <NavMeshAgent>().velocity = Vector3.zero; GetComponent <NavMeshAgent>().Stop(); } }
public Gamestate(PlayerUnit playerUnit, Unit unit, Scenery scenery, EventsState events, InputState input, PhysicsState physics, VideoState video, AudioState audio, TimeState time) { Assert.Ref(playerUnit, unit, scenery, events, input, physics, video, audio, time); PlayerUnit = playerUnit; Scenery = scenery; Unit = unit; Events = events; Input = input; Physics = physics; Video = video; Audio = audio; Time = time; }
// 시간 되돌리기 public void ReverseTime( TimeState beforeTS, TimeState dbBeforeTS, float linear, GameObject target, Components components ) { components.GetRigidBody2D().velocity = Vector2.up * Mathf.Lerp(dbBeforeTS.TActorSt.JumpHeight, beforeTS.TActorSt.JumpHeight, linear); components.GetAnimator().SetBool("isMove", beforeTS.TActorSt.IsMoveAnimator); target.transform.rotation = Quaternion.Euler(0, RotateYFloat, 0); }
public void Pause() { if (currentState != TimeState.Paused) { //Freeze Timescale and make note of previous scale //Assumes nothing else has control over time previousTimescale = Time.timeScale; Time.timeScale = 0.0f; if (pauseScreen) { pauseScreen.gameObject.SetActive(true); } this.currentState = TimeState.Paused; } }
private TimeSpan?LookForDelimiter(TimeState state) { while (true) { char c = _stream.Peek(0); if (c == EOF) { return(Finish(state)); } switch (c) { case ':': _stream.ReadChar(); return(LookForMinuteChar(state)); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return(LookForMinuteChar(state)); case 'p': case 'P': case 'a': case 'A': return(LookForAmPm(state)); case ' ': case '\t': case '\r': case '\n': _stream.ReadChar(); continue; default: return(null); } } }
// 시간과 관련된 정보를 등록한다. void RegisterTimeState() { // 상속을 사용해서 해결해본다? TimeState timeState = new TimeState(); // 이동 관련 정보 Vector2 vec2Pos = new Vector2(transform.position.x, transform.position.y); for (int i = 0; i < components.Properties.Length; i++) { switch (components.Properties[i]) { case Components.EnumProperty.OBJECT: TObjectState tos = new TObjectState { Position = vec2Pos, DeltaTime = Time.deltaTime, RealPlayTime = Time.realtimeSinceStartup }; timeState.TObjectSt = tos; tos.AttachEvent(timeState); break; case Components.EnumProperty.ACTOR: TActorState tas = new TActorState { JumpHeight = rb2D.velocity.y, IsMoveAnimator = components.GetAnimator().GetBool("isMove"), RotateYFloat = transform.rotation.eulerAngles.y }; timeState.TActorSt = tas; tas.AttachEvent(timeState); break; } } if (OtherRegisterEvent != null) { OtherRegisterEvent(); } TimeStates.Add(timeState); }
public void toggle_pause() { if (Input.anyKeyDown) { return; } if (_state == TimeState.Running) { _state = TimeState.Paused; _stopwatch.Stop(); } else if (_state == TimeState.Paused) { _state = TimeState.Running; _stopwatch.Start(); } }
public override void TimeStateChange(TimeState old, TimeState nu) { Rigidbody rb = GetComponent <Rigidbody>(); if (old != TimeState.Normal && nu == TimeState.Normal) { rb.isKinematic = false; rb.angularVelocity = m_lastAngularVelocity; rb.velocity = m_lastVelocity; } if (old == TimeState.Normal && nu != TimeState.Normal) { m_lastAngularVelocity = rb.angularVelocity; m_lastVelocity = rb.velocity; rb.isKinematic = true; } }
public void CallReverseTimeEvent( TimeState beforeTS, TimeState dbBeforeTS, float linear, GameObject gameObject, Components components) { if (reverseTimeEvent != null) { reverseTimeEvent( beforeTS, dbBeforeTS, linear, gameObject, components); } }
public void SlowTime(Transform hierarchy, int customSlowFactor = -1) { if (customSlowFactor == -1) { currentSlowFactor = SlowTimeFactor; } else { currentSlowFactor = customSlowFactor; } TraverseAndApplyToTimeHierarchy(hierarchy, (timeInteractable) => { timeInteractable.SlowTime(currentSlowFactor); }); timeState = TimeState.Slow; }
public void Open(TimeState ts) { //check the time that we're activating the door //make sure that the tile is a door in that time state and not a wall if (ts == TimeState.Past && past.SpriteSheet.Name.ToLower().Contains("door")) { past = pastOpen; pastCollidable = false; open = true; } else if (future.SpriteSheet.Name.ToLower().Contains("door")) { future = futureOpen; futureCollidable = false; open = true; } }
void ResetTimer() { if (IN_currentDay < 10) { Days.text = string.Format("0" + IN_currentDay); } else { Days.text = string.Format("" + IN_currentDay); } FL_actionPointsUsed = 0; BL_pause = false; State = TimeState.Daytime; BL_playerControlledEvent = true; }
public void RewindTime(Transform hierarchy, int customRewindSpeed = -1) { if (customRewindSpeed == -1) { currentRewindSpeed = RewindSpeed; } else { currentRewindSpeed = customRewindSpeed; } TraverseAndApplyToTimeHierarchy(hierarchy, (timeInteractable) => { timeInteractable.RewindTime(currentRewindSpeed); }); timeState = TimeState.Rewind; }
private void Initialise() { int hour = GetHour(time); int minute = GetMin(time); if (hour > hourNight || hour == hourNight && minute >= minNight || hour < hourDay || hour == hourDay && minute < minDay) { cycle = TimeState.NIGHT; if (HasNode("Canvas_DayNight")) { CanvasModulate CM = GetNode <CanvasModulate>("Canvas_DayNight"); CM.Color = MODCAN_N; } if (HasNode("fog")) { Material mat = GetNode <Sprite>("fog").Material; mat.Set("shader_param/mult", FOG_N); } if (GetTree().GetNodesInGroup("Player").Count == 1) { Light2D light = ((Node)GetTree().GetNodesInGroup("Player")[0]).GetNode <Light2D>("light"); light.Energy = PLAYERLIGHT_N; } } else { cycle = TimeState.DAY; if (HasNode("Canvas_DayNight")) { CanvasModulate CM = GetNode <CanvasModulate>("Canvas_DayNight"); CM.Color = MODCAN_D; } if (HasNode("fog")) { Material mat = GetNode <Sprite>("fog").Material; mat.Set("shader_param/mult", FOG_D); } if (GetTree().GetNodesInGroup("Player").Count == 1) { Light2D light = ((Node)GetTree().GetNodesInGroup("Player")[0]).GetNode <Light2D>("light"); light.Energy = PLAYERLIGHT_D; } } }
private void SwitchTimeState() { if (gamePaused) { return; } if (playerRB.velocity.x > 1f || playerRB.velocity.x < -1f || playerRB.velocity.y > 1f || playerRB.velocity.y < -1f) { timeState = TimeState.Normal; } else { timeState = TimeState.Stopped; } // if (Input.anyKey) timeState = TimeState.Normal; // else timeState = TimeState.Stopped; TimeShift(); }
private void UpdateColorManagement() { if (_isIgnoreUpdateWhileAnimation || _isIgnoreUpdates) { return; } TimeState timeState = GetTimeState(); if (_currentTimeState != timeState) { CurrentTimeState = timeState; } else { StartCoroutine(IgnoringUpdateUntilNextHour()); } }
private void Update() { if (Time.time > _nextStateChange) { switch (_currentState) { case TimeState.Stopping: _currentState = TimeState.Slow; _nextStateChange = Time.time + _slowHoldDuration; break; case TimeState.Slow: _currentState = TimeState.SpeedingUp; _nextStateChange = Time.time + _speedUpDuration; break; default: _currentState = TimeState.Regular; break; } } switch (_currentState) { case TimeState.Stopping: _timeScale = Mathf.Lerp(_timeScale, _slowTime, 1 - (_nextStateChange - Time.time)/_slowDownDuration); break; case TimeState.Slow: _timeScale = _slowTime; break; case TimeState.SpeedingUp: _timeScale = Mathf.Lerp(_timeScale, 1, 1 - (_nextStateChange - Time.time)/_speedUpDuration); break; default: _timeScale = 1; break; } Time.timeScale = _timeScale; Time.fixedDeltaTime = _initialFixedDelta*_timeScale; }
private TimeSpan? LookForHourChar(TimeState state, bool beenHere = false) { while (true) { char c = _stream.ReadChar(); if (c == EOF) return beenHere && state.IsComplete ? state.ToTimeSpan() : null; switch (c) { case '0': case '1': case '2': if (beenHere) { state.Hour *= 10; state.Hour += c - ZERO_CHAR; return LookForDelimiter(state); } else { state.Hour = c - ZERO_CHAR; beenHere = true; continue; } case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (beenHere) { state.Hour *= 10; state.Hour += c - ZERO_CHAR; } else state.Hour = c - ZERO_CHAR; return LookForDelimiter(state); case ' ': case '\t': case '\r': case '\n': beenHere = false; continue; default: return null; } } }
// Update is called once per frame void Update() { float currentTime = GlobalTime.getTime(); m_currentDeltaTime = currentTime - m_oldTime; // Check if inside buffer, then read from it setTimescaleStateBasedOnTime(currentTime); // Try to read from buffer if (isReadingFromBuffer()) { float t=0.0f; int deltaSign = getDeltaSign(); int currentPos = getBufferPosFromTime(currentTime, out t); // int nextPos = getBufferPosFromTime(GlobalTime.getTime(),out t); if (currentPos >= 0 && currentPos<m_buffer.Count) { TimeState currentState = m_buffer[currentPos]; // TimeState nextState = m_buffer[currentPos]; transform.position = new Vector3(currentState.m_position.x,currentState.m_position.y,transform.position.z); if (m_frameData == null) { transform.rotation = new Quaternion(currentState.m_rotation.x, currentState.m_rotation.y, currentState.m_rotation.z, currentState.m_rotation.w); } else { m_frameData.m_frameData = new Vector2(currentState.m_rotation.x, currentState.m_rotation.y); } transform.localScale = currentState.m_scale; } else // outside buffer, resume realtime { setTimescaleStateBasedOnTime(currentTime); } } // second check in case it was not read if (isWritingToBuffer()) { float t = 0.0f; int currentPos = getBufferPosFromTime(currentTime, out t); // TimeState newState = null; if (m_frameData == null) { newState = new TimeState(transform.position, transform.rotation, transform.localScale); } else { newState = new TimeState(transform.position, m_frameData.m_frameData, transform.localScale); } if (currentPos > m_buffer.Count-1) { m_buffer.Add(newState); m_endTime = currentTime; } else if (currentPos>=0) { m_buffer[currentPos] = newState; } // do not allow more than the specified amount of seconds if (m_buffer.Count > m_maxBufferLength) { m_startTime += m_stepSizeSec; m_buffer.RemoveAt(0); } } if (m_hideWhenNotSpawned) hideWhenNotExisting(); m_oldTime = currentTime; }
private TimeSpan? LookForAmPm(TimeState state) { while (true) { char c = _stream.ReadChar(); if (c == EOF) return Finish(state); switch (c) { case 'a': case 'A': state.Is24Hour = false; state.IsPM = false; return LookForAmPmEnd(state); case 'p': case 'P': state.Is24Hour = false; state.IsPM = true; return LookForAmPmEnd(state); case ' ': case '\t': case '\r': case '\n': continue; default: return null; } } }
public async Task OnSuccess(TimeState timeState) { await this._backgroundTileClient.NotificationManager.ShowDialogAsync( BandConstants.TileId, CTime2CoreResources.Get("BandService.ApplicationName"), CTime2CoreResources.Get("BandService.StampedSuccessfully")); }
private TimeSpan? LookForHourChar(TimeState state, bool beenHere = false) { char c = stream.ReadChar(); if (c == EOF) return beenHere && state.IsComplete ? state.ToTimeSpan() : null; switch (c) { case '0': case '1': case '2': if (beenHere) { state.Hour *= 10; state.Hour += ((int)c) - zeroChar; return LookForDelimiter(state); } else { state.Hour = ((int)c) - zeroChar; return LookForHourChar(state, true); } case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (beenHere) { state.Hour *= 10; state.Hour += ((int)c) - zeroChar; } else state.Hour = ((int)c) - zeroChar; return LookForDelimiter(state); case ' ': case '\t': case '\r': case '\n': return LookForHourChar(state, false); default: return null; } }
/// <summary> /// Starts the new turn. /// </summary> /// <returns> /// The new turn. /// </returns> protected IEnumerator startNewTurn(AWebCoroutine a){ WWW www = WWWX.Get(WebRequests.urlGetTurnState,WebRequests.authenticatedParameters); while (!www.isDone) { ProcessIsRunning = true; yield return www; } yield return new WaitForSeconds(5); m_TimeState = JSONDecoder.Decode<TimeState>(www.text); timer = m_TimeState.time_left; string state = m_TimeState.state; if(state == "processing"){ //make sure that the game had passed through "processing phase" isPutting = true; } if(state == "playing" && isPutting == true){ isAfterProcessing = true; } ProcessIsRunning = false; Debug.Log ("New Turn"); TimeIsRunning = false; yield break; }
public static Color GetHighlightColorByTimeState(TimeState state) { return Instance.GetColorByTimeState(state); }
private async Task OnSuccess(TimeState timeState) { var message = new VoiceCommandUserMessage { DisplayMessage = timeState.IsEntered() ? CTime2VoiceCommandServiceResources.Get("SuccessfullyCheckedIn") : CTime2VoiceCommandServiceResources.Get("SuccessfullyCheckedOut"), SpokenMessage = timeState.IsEntered() ? CTime2VoiceCommandServiceResources.Get("SuccessfullyCheckedIn") : CTime2VoiceCommandServiceResources.Get("SuccessfullyCheckedOut"), }; var response = VoiceCommandResponse.CreateResponse(message); await this._connection.ReportSuccessAsync(response); }
private TimeSpan? LookForMinuteChar(TimeState state, bool beenHere = false) { while (true) { char c = _stream.ReadChar(); if (c == EOF) return beenHere && state.IsComplete ? state.ToTimeSpan() : null; switch (c) { case 'a': case 'A': case 'p': case 'P': _stream.Backup(1); return LookForAmPm(state); case ' ': case '\t': case '\r': case '\n': beenHere = false; continue; case '0': case '1': case '2': case '3': case '4': case '5': if (beenHere) { state.Minute *= 10; state.Minute += c - ZERO_CHAR; return LookForAmPm(state); } else { state.Minute = c - ZERO_CHAR; beenHere = true; continue; } case '6': case '7': case '8': case '9': if (!beenHere) return null; // minutes can't start with 6-9 state.Minute *= 10; state.Minute += c - ZERO_CHAR; return LookForAmPm(state); default: return null; // invalid character } } }
public TimeSpan? Parse() { var state = new TimeState(); return LookForHourChar(state); }
public async Task SaveTimer(string employeeGuid, string rfidKey, DateTime time, string companyId, TimeState state, bool withGeolocation) { try { Geopoint location = withGeolocation ? await this._geoLocationService.TryGetGeoLocationAsync() : null; var responseJson = await this.SendRequestAsync("V2/SaveTimerV2.php", new Dictionary<string, string> { {"TimerKind", ((int) state).ToString()}, {"TimerText", string.Empty}, {"TimerTime", time.ToString("yyyy-MM-dd HH:mm:ss")}, {"EmployeeGUID", employeeGuid}, {"GUID", companyId}, {"RFID", rfidKey}, {"lat", location?.Position.Latitude.ToString(CultureInfo.InvariantCulture) ?? string.Empty }, {"long", location?.Position.Longitude.ToString(CultureInfo.InvariantCulture) ?? string.Empty } }); if (responseJson?.Value<int>("State") == 0) { this._eventAggregator.PublishOnCurrentThread(new UserStamped()); } } catch (Exception exception) { Logger.Warn($"Exception in method {nameof(this.SaveTimer)}. Employee: {employeeGuid}, Time: {time}, Company Id: {companyId}, State: {(int)state}"); Logger.Error(exception); throw new CTimeException(CTime2CoreResources.Get("CTimeService.ErrorWhileStamp"), exception); } }
public Task OnSuccess(TimeState timeState) => this._onSuccess(timeState);
private static TimeSpan? Finish(TimeState state) { return state.IsComplete ? state.ToTimeSpan() : null; }
private string GetSpriteNameByTimeState(TimeState timeState) { return _colorStates[(int)timeState].SpriteName; }
public static async Task SaveTimer(this ICTimeService self, User user, TimeState state) { await self.SaveTimer(user.Id, string.Empty, DateTime.Now, user.CompanyId, state, user.SupportsGeoLocation); }
/// <summary> /// Gets the turn time left. /// </summary> /// <returns> /// The turn time left. /// </returns> protected IEnumerator GetTurnTimeLeft(AWebCoroutine a) { WWW www = WWWX.Get(WebRequests.urlGetTurnState,WebRequests.authenticatedParameters); while (!www.isDone) { TimeIsRunning = true; yield return www; } yield return new WaitForSeconds(5); m_TimeState = JSONDecoder.Decode<TimeState>(www.text); timer = m_TimeState.time_left; TimeIsRunning = false; if(timer <= 0){ isTurnOver = true; } yield break; }
private Color GetColorByTimeState(TimeState timeState) { Color color = _colorStates[(int)timeState].Color; //print("ColorManagementSystemController.GetColorByTimeState: timeState -" + timeState + " color - " + color); return color; }
public async Task Stamp(ICTimeStampHelperCallback callback, TimeState timeState) { await this._applicationStateService.RestoreStateAsync(); if (this._applicationStateService.GetCurrentUser() == null) { Logger.Info("User is not logged in."); await callback.OnNotLoggedIn(); return; } bool checkedIn = await this._cTimeService.IsCurrentlyCheckedIn(this._applicationStateService.GetCurrentUser().Id); if (checkedIn && timeState.IsEntered()) { if (callback.SupportsQuestions()) { Logger.Info("User wants to check-in. But he is already. Asking him if he wants to check-out instead."); var checkOutResult = await callback.OnAlreadyCheckedInWannaCheckOut(); if (checkOutResult == false) { Logger.Info("User does not want to check-out. Doing nothing."); await callback.OnDidNothing(); return; } timeState = TimeState.Left; } else { Logger.Info("User wants to check-in. But he is already. Doing nothing."); await callback.OnAlreadyCheckedIn(); return; } } if (checkedIn == false && timeState.IsLeft()) { if (callback.SupportsQuestions()) { Logger.Info("User wants to check-out. But he is already. Asking him if he wants to check-in instead."); var checkInResult = await callback.OnAlreadyCheckedOutWannaCheckIn(); if (checkInResult == false) { Logger.Info("User does not want to check-in. Doing nothing."); await callback.OnDidNothing(); return; } timeState = TimeState.Entered; } else { Logger.Info("User wants to check-out. But he is already. Doing nothing."); await callback.OnAlreadyCheckedOut(); return; } } Logger.Info("Saving the timer."); await this._cTimeService.SaveTimer( this._applicationStateService.GetCurrentUser(), timeState); Logger.Info("Finished voice command."); await callback.OnSuccess(timeState); }
//dilate: begin the slowdown process public void dilate(float targetScale, float duration) { this.targetScale = targetScale; this.duration = duration; timeState = TimeState.Slowing; }
private TimeSpan? LookForDelimiter(TimeState state) { while (true) { char c = _stream.Peek(0); if (c == EOF) return Finish(state); switch (c) { case ':': _stream.ReadChar(); return LookForMinuteChar(state); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return LookForMinuteChar(state); case 'p': case 'P': case 'a': case 'A': return LookForAmPm(state); case ' ': case '\t': case '\r': case '\n': _stream.ReadChar(); continue; default: return null; } } }
private TimeSpan? LookForAmPmEnd(TimeState state) { char c = _stream.ReadChar(); if (c == EOF) return Finish(state); switch (c) { case 'm': case 'M': return Finish(state); default: return null; } }
private void Start() { _instance = this; _initialFixedDelta = Time.fixedDeltaTime; _currentState = TimeState.Regular; }