123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using UnityEngine;
- namespace Animancer.Examples
- {
-
-
-
-
-
-
- [AddComponentMenu(Strings.ExamplesMenuPrefix + "Time Scale")]
- [HelpURL(Strings.DocsURLs.APIDocumentation + "." + nameof(Examples) + "/" + nameof(TimeScale))]
- public sealed class TimeScale : MonoBehaviour
- {
-
- [SerializeField, Range(0, 1)]
- private float _Value = 0.5f;
- public float Value
- {
- get => _Value;
- set
- {
- _Value = value;
- #if UNITY_EDITOR
- if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
- return;
- #endif
- Time.timeScale = _Value;
- }
- }
-
- private void Awake()
- {
- Value = _Value;
- }
-
- private void OnValidate()
- {
- Value = _Value;
- }
-
- }
- }
|