Mercurial > hg > Game > Games
diff Orchestland/Assets/Scripts/Shot.cs @ 3:0030a1b971fb default tip
merge
author | Yuta ANSE <e135745@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2015 23:23:43 +0900 |
parents | f7675884f2a1 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orchestland/Assets/Scripts/Shot.cs Fri Jul 17 23:23:43 2015 +0900 @@ -0,0 +1,30 @@ +using UnityEngine; +using System.Collections; + +public class Shot : MonoBehaviour { + public HandController hand_controller; + public GameObject bullet_prefab; + + int time = 0; + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + time++; + if (time > 60) { + time = 0; + HandModel[] hands = hand_controller.GetAllPhysicsHands(); + foreach(HandModel hand in hands){ + FingerModel[] fingers = hand.fingers; + foreach(FingerModel finger in fingers){ + GameObject bullet = (GameObject)Instantiate(bullet_prefab); + bullet.transform.position = finger.bones[3].position + finger.bones[3].forward * 0.5f; + bullet.GetComponent<Rigidbody>().velocity = finger.bones[3].forward * 5.0f; + } + } + } + } +}