forked from dantaeyoung/160402_SOWG_worldbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InitializeCamera.cs
executable file
·106 lines (81 loc) · 2.04 KB
/
InitializeCamera.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using UnityOSC;
public class InitializeCamera : MonoBehaviour {
public CameraPath camerapath;
public Transform[] cameras;
public bool checkTime = false;
private float[] startPositions = new float[7];
public int goHour;
public int goMinute;
private float pathSpeed;
// set starting position (0-6)
//public static int index = 4;
// PHONE B = 5
// PHONE A = 2
// COMPUTER = 2
public static int index = 2;
public GameObject[] thingsToActivate;
void Awake(){
// set initial camera position positions
float step = 1.0f / 7.0f;
for (int i = 0; i < 7; i++) {
startPositions[i] = (float) i*step;
}
// explicitly set two positions
startPositions [3] = 0.376f;
startPositions [6] = 0.82f;
// get time
DateTime time = DateTime.Now;
int hour = time.Hour;
int minute = time.Minute;
goHour = hour;
goMinute = ((int)Math.Ceiling(minute / 10.0)) * 10;
if (goMinute > 51) {
goHour++;
goMinute = 00;
}
if (goHour > 24)
goHour = 01;
}
void Start(){
// enable touch in vr
//Cardboard.SDK.TapIsTrigger = false;
}
void Update(){
DateTime time = DateTime.Now;
int hour = time.Hour;
int minute = time.Minute;
// start on next 10th minute
if (checkTime) {
if ((hour.CompareTo (goHour) == 0) && (minute.CompareTo (goMinute) == 0)) {
startCamera ();
}
} else {
startCamera ();
}
}
public void startCamera(){
cameras [index].gameObject.SetActive (true);
// enable touch in vr
//Cardboard.SDK.TapIsTrigger = false;
CameraPathAnimator cpa = camerapath.GetComponent<CameraPathAnimator> ();
cpa.animationObject = cameras [index];
cpa.Seek (startPositions[index]);
cpa.Play ();
// switch on vr, switch off canvas
//Cardboard.SDK.TapIsTrigger = true;
gameObject.SetActive (false);
//initialize rest
initializeGameObject();
}
void initializeGameObject(){
/*
for (int i = 0; i < thingsToActivate.Length; i++) {
thingsToActivate [i].SetActive (true);
}
*/
}
}