You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 regels
1.0 KiB

  1. using System;
  2. using UnityEngine;
  3. namespace Tweening
  4. {
  5. public sealed class GameObjectToggleTweenerTrack : TweenerTrack<Component, bool>
  6. {
  7. public override void UpdateComponentValue(float evaluatedTime)
  8. {
  9. bool flag = Mathf.Approximately(Mathf.LerpUnclamped((!this._from) ? 0f : 1f, (!this._to) ? 0f : 1f, evaluatedTime), 1f);
  10. if (this._component.gameObject.activeSelf != flag)
  11. {
  12. this._component.gameObject.SetActive(flag);
  13. }
  14. }
  15. public override void ResetComponentValue()
  16. {
  17. if (this._dynamicFrom)
  18. {
  19. this._from = this._component.gameObject.activeSelf;
  20. }
  21. else if (this._component.gameObject.activeSelf != this._from)
  22. {
  23. this._component.gameObject.SetActive(this._from);
  24. }
  25. }
  26. public override void InitializeComponentValue()
  27. {
  28. if (this._dynamicFrom)
  29. {
  30. this._from = this._component.gameObject.activeSelf;
  31. }
  32. else if (this._component.gameObject.activeSelf != this._from)
  33. {
  34. this._component.gameObject.SetActive(this._from);
  35. }
  36. }
  37. }
  38. }