Mercurial > hg > Game > Games
comparison Orchestland/Assets/Scripts/Shot.cs @ 1:f7675884f2a1
Add Orchestland project
author | Daiki OYAKAWA <e135764@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2015 23:09:20 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:347d21cdfc22 | 1:f7675884f2a1 |
---|---|
1 using UnityEngine; | |
2 using System.Collections; | |
3 | |
4 public class Shot : MonoBehaviour { | |
5 public HandController hand_controller; | |
6 public GameObject bullet_prefab; | |
7 | |
8 int time = 0; | |
9 // Use this for initialization | |
10 void Start () { | |
11 | |
12 } | |
13 | |
14 // Update is called once per frame | |
15 void Update () { | |
16 time++; | |
17 if (time > 60) { | |
18 time = 0; | |
19 HandModel[] hands = hand_controller.GetAllPhysicsHands(); | |
20 foreach(HandModel hand in hands){ | |
21 FingerModel[] fingers = hand.fingers; | |
22 foreach(FingerModel finger in fingers){ | |
23 GameObject bullet = (GameObject)Instantiate(bullet_prefab); | |
24 bullet.transform.position = finger.bones[3].position + finger.bones[3].forward * 0.5f; | |
25 bullet.GetComponent<Rigidbody>().velocity = finger.bones[3].forward * 5.0f; | |
26 } | |
27 } | |
28 } | |
29 } | |
30 } |