VR模拟枪支打靶,消灭鬼怪,换弹以及上弦等等硬核枪支操作。 使用HTCVive设备,开启SteamVR进行游玩。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
1.1 KiB

using System;
using UnityEngine;
using UnityEngine.UI;
namespace UnityStandardAssets.SceneUtils
{
public class SlowMoButton : MonoBehaviour
{
public Sprite FullSpeedTex; // the ui texture for full speed
public Sprite SlowSpeedTex; // the ui texture for slow motion mode
public float fullSpeed = 1;
public float slowSpeed = 0.3f;
public Button button; // reference to the ui texture that will be changed
private bool m_SlowMo;
void Start()
{
m_SlowMo = false;
}
void OnDestroy()
{
Time.timeScale = 1;
}
public void ChangeSpeed()
{
// toggle slow motion state
m_SlowMo = !m_SlowMo;
// update button texture
var image = button.targetGraphic as Image;
if (image != null)
{
image.sprite = m_SlowMo ? SlowSpeedTex : FullSpeedTex;
}
button.targetGraphic = image;
Time.timeScale = m_SlowMo ? slowSpeed : fullSpeed;
}
}
}