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.
 
 
 
 
 

30 lines
933 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//通过菜单创建一个弹夹,设定好弹夹(设定好之后通过shake动作来进行创建)
public class ClipInstall : MonoBehaviour {
public GameObject clipMenu;
public List<GameObject> clipList;
public int clipID = 0;
public GameObject leftHand;
public GameObject other;
public Menu menu;
public float force;
public void openClipMenu()
{
clipMenu.SetActive(true);
menu.shakeEvent.AddListener(produceClip);
}
public void closeClipMenu()
{
clipMenu.SetActive(false);
}
public void produceClip()
{
GameObject newClip = Instantiate(clipList[clipID], other.transform);
newClip.transform.position = leftHand.transform.position + new Vector3(0f,0.2f,0f);
newClip.GetComponent<Rigidbody>().AddForce(leftHand.transform.up * force);
}
}