Mercurial > hg > Game > Games
comparison 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 |
comparison
equal
deleted
inserted
replaced
2:fdab88fc2cb9 | 3:0030a1b971fb |
---|---|
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 } |