Download data/Assets/Scripts/Common/TimeScaler.cs from introvoyz042/CRESSim: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/datasets/introvoyz042/CRESSim/resolve/main/data/Assets/Scripts/Common/TimeScaler.cs
- Command line
-
hf download hf://datasets/introvoyz042/CRESSim/data/Assets/Scripts/Common/TimeScaler.cs
-
curl -L -o TimeScaler.cs https://huggingface.co/datasets/introvoyz042/CRESSim/resolve/main/data/Assets/Scripts/Common/TimeScaler.cs
1.04 kB
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class TimeScaler : MonoBehaviour | |
| { | |
| void OnEnable() | |
| { | |
| m_fixedDeltaTime = Time.fixedDeltaTime; | |
| if (!m_scaleWaitingOnly) | |
| { | |
| Time.timeScale = m_timeScale; | |
| // Time.fixedDeltaTime = m_fixedDeltaTime * Time.timeScale; | |
| } | |
| } | |
| void FixedUpdate() | |
| { | |
| if (m_scaleWaitingOnly) | |
| { | |
| if (m_agent.InEpisode) | |
| { | |
| Time.timeScale = 1f; | |
| Time.fixedDeltaTime = m_fixedDeltaTime; | |
| } | |
| else | |
| { | |
| Time.timeScale = m_timeScale; | |
| } | |
| } | |
| } | |
| void OnDisable() | |
| { | |
| Time.timeScale = 1f; | |
| Time.fixedDeltaTime = m_fixedDeltaTime; | |
| } | |
| [] | |
| private bool m_scaleWaitingOnly = false; | |
| [] | |
| private float m_timeScale; | |
| [] | |
| private SuctionIrrigationAgentBase m_agent; | |
| private float m_fixedDeltaTime; | |
| } | |