void RunTimer(float _time, FloatWrapper _timer, FloatWrapper _perc) { _timer.Value += Time.deltaTime; if (_timer.Value > _time) { _timer.Value = _time; } _perc.Value = _timer.Value / _time; }
public Task PutComplexPrimitiveFloat() => TestStatus(async(host, pipeline) => { var value = new FloatWrapper { Field1 = 1.05F, Field2 = -0.003F }; return(await new PrimitiveClient(ClientDiagnostics, pipeline, host).PutFloatAsync(value)); });
public virtual Response PutFloat(FloatWrapper complexBody, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrimitiveClient.PutFloat"); scope.Start(); try { return(RestClient.PutFloat(complexBody, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response> PutFloatAsync(FloatWrapper complexBody, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrimitiveClient.PutFloat"); scope.Start(); try { return(await RestClient.PutFloatAsync(complexBody, cancellationToken).ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }
IEnumerator StartControlFade(float _startHor, float _time) { FloatWrapper timer = new FloatWrapper(0); FloatWrapper perc = new FloatWrapper(0); controlFading = true; while (perc.Value < 1 && !grounded && !climbing) { RunTimer(_time, timer, perc); float hor = Mathf.Lerp(_startHor, inputHor, perc.Value); move = transform.right * hor; yield return(new WaitForEndOfFrame()); } controlFading = false; }
IEnumerator <float> StartControlFade(float _time) { FloatWrapper timer = new FloatWrapper(0); FloatWrapper perc = new FloatWrapper(0); var startDir = movementInput; controlFading = true; while (perc.Value < 1 && !grounded && !climbing) { RunTimer(_time, timer, perc); var tempMove = Vector3.Lerp(startDir, movementInput, perc.Value); movementInput = tempMove; yield return(Timing.WaitForOneFrame); } controlFading = false; }
public static IEnumerator ChangeFloatValueBySpeed(FloatWrapper _curValue, float _targetValue, float _speed) { var startValue = _curValue.Value; var diff = Mathf.Abs(_targetValue - _curValue.Value); var time = diff / _speed; float timer = 0; float perc = 0; while (timer < time) { timer += Time.deltaTime; if (timer > time) { timer = time; } perc = timer / time; _curValue.Value = Mathf.Lerp(startValue, _targetValue, perc); yield return(new WaitForEndOfFrame()); } }
//This region contains all HUD data #region HUD data void initializeHUD() { hud = new HUDComponent(this, GraphicsDevice); BaseTextType temp; temp = new BaseTextType("Score:", "Fonts/LindseySmall", new Vector2(10, 5), Color.Blue); hud.addText(temp); temp = new BaseTextType("Score Number", "Fonts/LindseySmall", new Vector2(55, 5), Color.Blue); temp = new NumberWrapper(temp, score); hud.addText(temp); temp = new BaseTextType("Lives:", "Fonts/LindseySmall", new Vector2(100, 5), Color.Blue); hud.addText(temp); temp = new BaseTextType("Lives Number", "Fonts/LindseySmall", new Vector2(145, 5), Color.Blue); temp = new NumberWrapper(temp, lives); hud.addText(temp); temp = new BaseTextType("Level:", "Fonts/LindseySmall", new Vector2(170, 5), Color.Blue); hud.addText(temp); temp = new BaseTextType("Level Number", "Fonts/LindseySmall", new Vector2(220, 5), Color.Blue); temp = new NumberWrapper(temp, levelNumber); hud.addText(temp); temp = new BaseTextType("Add Score Number", "Fonts/LindseySmall", new Vector2(60, 15), Color.Yellow); temp = new NumberWrapper(temp, 0); temp = new FloatWrapper(temp, new Vector2(0, 3), 1.0f); temp = new FadeWrapper(temp, 1.0f, -1); temp = new ScaleWrapper(temp, 1.02f, 1.0f, 1.0f); hud.addText(temp); Components.Add(hud); }
/// <summary> /// Put complex types with float properties /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put 1.05 and -0.003 /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PutFloatAsync(this IPrimitive operations, FloatWrapper complexBody, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.PutFloatWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Put complex types with float properties /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put 1.05 and -0.003 /// </param> public static void PutFloat(this IPrimitive operations, FloatWrapper complexBody) { operations.PutFloatAsync(complexBody).GetAwaiter().GetResult(); }
/// <summary> /// Put complex types with float properties /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put 1.05 and -0.003 /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task PutFloatAsync(this IPrimitiveOperations operations, FloatWrapper complexBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { await operations.PutFloatWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Put complex types with float properties /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put 1.05 and -0.003 /// </param> public static void PutFloat(this IPrimitiveOperations operations, FloatWrapper complexBody) { System.Threading.Tasks.Task.Factory.StartNew(s => ((IPrimitiveOperations)s).PutFloatAsync(complexBody), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Put complex types with float properties /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put 1.05 and -0.003 /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PutFloatAsync(this IPrimitiveOperations operations, FloatWrapper complexBody, CancellationToken cancellationToken = default(CancellationToken)) { await operations.PutFloatWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Put complex types with float properties /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put 1.05 and -0.003 /// </param> public static void PutFloat(this IPrimitiveOperations operations, FloatWrapper complexBody) { Task.Factory.StartNew(s => ((IPrimitiveOperations)s).PutFloatAsync(complexBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Put complex types with float properties /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='complexBody'> /// Please put 1.05 and -0.003 /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task PutFloatAsync(this IPrimitive operations, FloatWrapper complexBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { await operations.PutFloatWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false); }
//This region contains code for the HUD component, such as initializing and loading, as well as Event Handlers #region HUD Data void initializeHUD() { hud = new HUDComponent(this, GraphicsDevice); BaseTextType temp; temp = new TextType("Score", new Vector2(190, 90), Color.Red); hud.addText(temp); temp = new TextType("Score Number", new Vector2(190, 105), Color.Red); temp = new NumberWrapper(temp, score); hud.addText(temp); temp = new TextType("Level", new Vector2(190, 130), Color.Red); hud.addText(temp); temp = new TextType("Level Number", new Vector2(210, 145), Color.Red); temp = new NumberWrapper(temp, level); hud.addText(temp); temp = new TextType("Bonus", new Vector2(190, 170), Color.Red); hud.addText(temp); temp = new TextType("Multiplier Number", new Vector2(210, 185), Color.Red); temp = new NumberWrapper(temp, multiplier); hud.addText(temp); temp = new TextType("High\nScore", new Vector2(190, 210), Color.Red); hud.addText(temp); temp = new TextType("High Score Number", new Vector2(190, 245), Color.Red); temp = new NumberWrapper(temp, highScores.getHighScore()); hud.addText(temp); temp = new TextType("Next Level", new Vector2(25, 160), Color.White); temp = new FloatWrapper(temp, new Vector2(0, -3), 3.0f); hud.addText(temp); temp = new TextType("Next Level Number", new Vector2(90, 190), Color.White); temp = new NumberWrapper(temp, level); temp = new FloatWrapper(temp, new Vector2(0, -3), 3.0f); hud.addText(temp); temp = new TextType("Add Score Number", new Vector2(80, 240), Color.Yellow); temp = new NumberWrapper(temp, 0); temp = new FloatWrapper(temp, new Vector2(0, -3), 1.0f); hud.addText(temp); temp = new TextType("Multiplier Bonus", new Vector2(100, 100), Color.Orange); temp = new ScaleWrapper(temp, 1, 1.5f, 0.5f, 3); hud.addText(temp); temp = new TextType("Add Multiplier Number", new Vector2(100, 130), Color.Orange); temp = new NumberWrapper(temp, level); temp = new ScaleWrapper(temp, 1, 1.5f, 0.5f, 3); hud.addText(temp); temp = new TextType("Bonus Expired", new Vector2(25, 120), Color.Orange); temp = new FadeWrapper(temp, 4); hud.addText(temp); Components.Add(hud); }