// 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 }
public void SetAlpha(float _value) { alpha = _value; alpha = Mathf.Clamp01(alpha); if (alpha == 0) { alphaStatus = HUDAlphaStat.Zero; } else { if (alpha == 1) { alphaStatus = HUDAlphaStat.Full; } else { alphaStatus = HUDAlphaStat.Mid; } } }
public void StartIncreasingAlpha(float _speed) { alphaChangeSpeed = _speed; alphaStatus = HUDAlphaStat.Increasing; }