VirtualFramework/Assets/Scripts/TimeScaleController.cs

51 lines
1.2 KiB
C#
Raw Normal View History

2025-01-02 09:49:19 +08:00
using QFramework;
2024-12-27 17:25:30 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimeScaleController : MonoBehaviour
{
[Range(0, 10)]
public float animSpeed = 1.0f;
2025-01-02 09:49:19 +08:00
#if UNITY_WEBGL
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CopyToClipboard(string text);
#endif
2024-12-27 17:25:30 +08:00
private void Update()
{
Time.timeScale = animSpeed;
2024-12-30 11:42:27 +08:00
if (Input.GetKeyUp(KeyCode.F8))
{
animSpeed++;
}
if (Input.GetKeyUp(KeyCode.F7))
{
animSpeed--;
}
if (Input.GetKeyUp(KeyCode.F12))
{
animSpeed = 1;
}
if (Input.GetKeyUp(KeyCode.F11))
{
animSpeed = 0;
}
2025-01-02 09:49:19 +08:00
#if UNITY_WEBGL
if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightControl))
{
if (Input.GetKeyDown(KeyCode.W))
{
Debug.Log("Ctrl + W <20><><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>");
string str = string.Empty;
str = $"Posision:{gameObject.transform.position}\nRotate:{gameObject.transform.eulerAngles}";
CopyToClipboard(str);
}
}
#endif
2024-12-27 17:25:30 +08:00
}
2024-12-31 17:40:54 +08:00
2024-12-27 17:25:30 +08:00
}