VirtualFramework/Assets/Scripts/TimeScaleController.cs
2025-01-02 10:24:01 +08:00

51 lines
1.2 KiB
C#

using QFramework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimeScaleController : MonoBehaviour
{
[Range(0, 10)]
public float animSpeed = 1.0f;
#if UNITY_WEBGL
[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern void CopyToClipboard(string text);
#endif
private void Update()
{
Time.timeScale = animSpeed;
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;
}
#if UNITY_WEBGL
if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightControl))
{
if (Input.GetKeyDown(KeyCode.Q))
{
Debug.Log("Ctrl + Q ±»°´Ï£¡");
string str = string.Empty;
str = $"Posision:{gameObject.transform.position}\nRotate:{gameObject.transform.eulerAngles}";
CopyToClipboard(str);
}
}
#endif
}
}