|
- using System;
- using UnityEngine;
-
- namespace Tweening
- {
- public sealed class GameObjectToggleTweenerTrack : TweenerTrack<Component, bool>
- {
- public override void UpdateComponentValue(float evaluatedTime)
- {
- bool flag = Mathf.Approximately(Mathf.LerpUnclamped((!this._from) ? 0f : 1f, (!this._to) ? 0f : 1f, evaluatedTime), 1f);
- if (this._component.gameObject.activeSelf != flag)
- {
- this._component.gameObject.SetActive(flag);
- }
- }
-
- public override void ResetComponentValue()
- {
- if (this._dynamicFrom)
- {
- this._from = this._component.gameObject.activeSelf;
- }
- else if (this._component.gameObject.activeSelf != this._from)
- {
- this._component.gameObject.SetActive(this._from);
- }
- }
-
- public override void InitializeComponentValue()
- {
- if (this._dynamicFrom)
- {
- this._from = this._component.gameObject.activeSelf;
- }
- else if (this._component.gameObject.activeSelf != this._from)
- {
- this._component.gameObject.SetActive(this._from);
- }
- }
- }
- }
|