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
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); |
|
} |
|
}
|
|
|