-
Notifications
You must be signed in to change notification settings - Fork 0
/
FPSKinectCameraScript.cs
executable file
·66 lines (58 loc) · 1.95 KB
/
FPSKinectCameraScript.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using UnityEngine;
using System.Collections;
public class FPSKinectCameraScript : MonoBehaviour {
public PlayerScript script_player;
public GameObject player;
// Use this for initialization
public GameObject KinectAvatar;
public InputController script_kinect;
void OnNetworkLoadedLevel () {
player = GameObject.FindGameObjectWithTag("Player");
script_player = player.GetComponent(typeof(PlayerScript)) as PlayerScript;
KinectAvatar = GameObject.FindGameObjectWithTag("KinectAvatar");
script_kinect = KinectAvatar.GetComponent(typeof(InputController)) as InputController;
}
// Update is called once per frame
void Update ()
{
if (player != null && script_player != null)
{
this.transform.position = player.transform.position + player.transform.up*2.0f;
this.transform.rotation = script_player.getCameraRotation();
}
}
void OnGUI()
{
if (player != null && script_player != null)
{
if (script_kinect.timer < 100)
{
GUI.Label(new Rect(100, 100, 600, 600), "5");
}
else if (script_kinect.timer < 200)
{
GUI.Label(new Rect(100, 100, 600, 600), "4");
}
else if (script_kinect.timer < 300)
{
GUI.Label(new Rect(100, 100, 600, 600), "3");
}
else if (script_kinect.timer < 400)
{
GUI.Label(new Rect(100, 100, 600, 600), "2");
}
else if (script_kinect.timer < 500)
{
GUI.Label(new Rect(100, 100, 600, 600), "1");
}
else if (script_kinect.timer < 550)
{
GUI.Label(new Rect(100, 100, 600, 600), "GO");
}
}
}
public Transform getTransform()
{
return transform;
}
}