using System.Collections; using System.Collections.Generic; using UnityEngine; //通过菜单创建一个弹夹,设定好弹夹(设定好之后通过shake动作来进行创建) public class ClipInstall : MonoBehaviour { public GameObject clipMenu; public List 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().AddForce(leftHand.transform.up * force); } }