1
- #pragma strict
2
-
3
- public var force:float = 1.0 ;
4
- var dir : Vector3 = Vector3 . zero ;
5
- public var touchingSomething:boolean = false ;
6
-
7
- private var isLoading = false ;
8
- var levelToLoad : String = "scene-helix" ;
9
- var levelToLoad2 : String = "scene-bluesky" ;
10
- var levelToLoad3 : String = "falling-column-space" ;
11
- var levelToLoad4 : String = "scene-bluesky" ;
12
-
13
- // Move object using accelerometer
14
- var speed = 5.0 ;
15
- var target : Transform ;
16
- var smooth = 2.0 ;
17
- var tiltAngle = 30.0 ;
18
-
19
- var script : ScoreController ;
20
- script = GetComponent ( "ScoreController" ) ;
21
-
22
- static var isAlive : boolean ;
23
-
24
- function DeathRespawn ( ) {
25
- var respawnPosition = Respawn . currentRespawn . transform . position ;
26
- Camera . main . SendMessage ( "fadeOut" ) ;
27
- isAlive = true ;
28
- gameObject . SendMessage ( "ResetScore" , 0 ) ;
29
- yield WaitForSeconds ( 1 ) ;
30
- // gameObject.SendMessage ("DecrementScore");
31
- // gameObject.SendMessage ("ZeroScore", 1);
32
-
33
- // Camera.main.transform.position = respawnPosition - (transform.forward * 4) + Vector3.up; // reset camera too
34
- GetComponent . < Collider > ( ) . attachedRigidbody . transform . Translate ( respawnPosition ) ;
35
- // Relocate the player. We need to do this or the camera will keep trying to focus on the (invisible) player where he's standing on top of the FalloutDeath box collider.
36
- transform . position = respawnPosition ; // + Vector3.up;
37
- Camera . main . SendMessage ( "fadeIn" ) ;
38
- }
1
+ // #pragma strict
2
+
3
+ // public var force:float = 1.0;
4
+ // var dir : Vector3 = Vector3.zero;
5
+ // public var touchingSomething:boolean = false;
6
+
7
+ // private var isLoading = false;
8
+ // var levelToLoad : String = "scene-helix";
9
+ // var levelToLoad2 : String = "scene-bluesky";
10
+ // var levelToLoad3 : String = "falling-column-space";
11
+ // var levelToLoad4 : String = "scene-bluesky";
12
+
13
+ // // Move object using accelerometer
14
+ // var speed = 5.0;
15
+ // var target : Transform;
16
+ // var smooth = 2.0;
17
+ // var tiltAngle = 30.0;
18
+
19
+ // var script : ScoreController;
20
+ // script = GetComponent("ScoreController");
21
+
22
+ // static var isAlive : boolean;
23
+
24
+ // function DeathRespawn () {
25
+ // var respawnPosition = Respawn.currentRespawn.transform.position;
26
+ // Camera.main.SendMessage("fadeOut");
27
+ // isAlive = true;
28
+ // gameObject.SendMessage ("ResetScore", 0);
29
+ // yield WaitForSeconds(1);
30
+ // // gameObject.SendMessage ("DecrementScore");
31
+ // // gameObject.SendMessage ("ZeroScore", 1);
32
+
33
+ // // Camera.main.transform.position = respawnPosition - (transform.forward * 4) + Vector3.up; // reset camera too
34
+ // GetComponent.<Collider>().attachedRigidbody.transform.Translate(respawnPosition);
35
+ // // Relocate the player. We need to do this or the camera will keep trying to focus on the (invisible) player where he's standing on top of the FalloutDeath box collider.
36
+ // transform.position = respawnPosition; // + Vector3.up;
37
+ // Camera.main.SendMessage("fadeIn");
38
+ // }
39
39
40
- function Awake ( ) {
41
- // Make the game run as fast as possible in the web player
42
- // Application.targetFrameRate = 60;
43
- Time . timeScale = 1.0 ;
44
- }
40
+ // function Awake () {
41
+ // // Make the game run as fast as possible in the web player
42
+ // // Application.targetFrameRate = 60;
43
+ // Time.timeScale = 1.0;
44
+ // }
45
45
46
- function Update ( ) {
47
- var dir : Vector3 = Vector3 . zero ;
48
-
49
- var tiltAroundZ = - Input . acceleration . y * tiltAngle ;
50
- var tiltAroundX = - Input . acceleration . x * tiltAngle ;
51
- var target = Quaternion . Euler ( tiltAroundX , 0 , tiltAroundZ ) ;
52
-
53
- // Dampen towards the target rotation
54
- transform . rotation = Quaternion . Slerp ( transform . rotation , target ,
55
- Time . deltaTime * smooth ) ; ;
56
- // Debug.Log(isAlive);
57
- // Debug.Log(script.currentScore);
58
- }
46
+ // function Update () {
47
+ // var dir : Vector3 = Vector3.zero;
48
+
49
+ // var tiltAroundZ = -Input.acceleration.y * tiltAngle;
50
+ // var tiltAroundX = -Input.acceleration.x * tiltAngle;
51
+ // var target = Quaternion.Euler (tiltAroundX, 0, tiltAroundZ);
52
+
53
+ // // Dampen towards the target rotation
54
+ // transform.rotation = Quaternion.Slerp(transform.rotation, target,
55
+ // Time.deltaTime * smooth);;
56
+ // // Debug.Log(isAlive);
57
+ // // Debug.Log(script.currentScore);
58
+ // }
59
59
60
- // private var speed : Vector3 = Vector3 (3, 0, 0);
61
- // var startingPosition = (0, 129, 0);
62
- var deadlyObjectName : String = "DeathByFire" ;
63
- var initialRespawn : Respawn ; // set this to the initial respawn point for the level.
64
- // var damping:float = 0.7; // is this necessary?
60
+ // // private var speed : Vector3 = Vector3 (3, 0, 0);
61
+ // // var startingPosition = (0, 129, 0);
62
+ // var deadlyObjectName : String = "DeathByFire";
63
+ // var initialRespawn : Respawn; // set this to the initial respawn point for the level.
64
+ // // var damping:float = 0.7; // is this necessary?
65
65
66
- // textfield to hold the score and score variable
67
- private var textfield:GUIText ;
68
- private var score:int ;
66
+ // // textfield to hold the score and score variable
67
+ // private var textfield:GUIText;
68
+ // private var score:int;
69
69
70
- public var simulateAccelerometer:boolean = false ;
70
+ // public var simulateAccelerometer:boolean = false;
71
71
72
72
73
- function OnCollisionEnter ( collision : Collision ) {
74
- // Debug.Log("Hit something!" + collision.contacts[0].normal + dir.x + dir.z + Input.acceleration.x);
75
- Screen . sleepTimeout = 0.0 f ;
76
- // collider.attachedRigidbody.velocity.y *= damping;
73
+ // function OnCollisionEnter (collision : Collision) {
74
+ // // Debug.Log("Hit something!" + collision.contacts[0].normal + dir.x + dir.z + Input.acceleration.x);
75
+ // Screen.sleepTimeout = 0.0f;
76
+ // // collider.attachedRigidbody.velocity.y *= damping;
77
77
78
78
79
- // collider.attachedRigidbody.AddForce(dir * force);
79
+ // // collider.attachedRigidbody.AddForce(dir * force);
80
80
81
- // iPhoneUtils.Vibrate ();
82
- // var relativeStartingPosition = transform.InverseTransformPoint(0, -500, 0);
81
+ // // iPhoneUtils.Vibrate ();
82
+ // // var relativeStartingPosition = transform.InverseTransformPoint(0, -500, 0);
83
83
84
84
85
85
86
- // if (collision.gameObject.name == deadlyObjectName){
87
- if ( collision . gameObject . CompareTag ( "Death" ) ) {
88
- DeathRespawn ( ) ;
89
- }
86
+ // // if (collision.gameObject.name == deadlyObjectName){
87
+ // if (collision.gameObject.CompareTag ("Death")) {
88
+ // DeathRespawn ();
89
+ // }
90
90
91
91
92
- // if (collision.gameObject.layer == 8){
93
- // collider.attachedRigidbody.transform.Translate(relativeStartingPosition);
92
+ // // if (collision.gameObject.layer == 8){
93
+ // // collider.attachedRigidbody.transform.Translate(relativeStartingPosition);
94
94
95
- // Destroy the projectile
96
- // Destroy (gameObject);
97
- //if (relativeStartingPosition.y > 100)
98
- // Debug.Log("You've moved up more than 100 units");
95
+ // // Destroy the projectile
96
+ // // Destroy (gameObject);
97
+ // // if (relativeStartingPosition.y > 100)
98
+ // // Debug.Log("You've moved up more than 100 units");
99
99
100
- }
100
+ // }
101
101
102
102
103
- // function FixedUpdate () {
104
- // rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime); }
103
+ // // function FixedUpdate () {
104
+ // / / rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime); }
105
105
106
106
107
- function OnTriggerEnter ( other : Collider ) {
108
- if ( other . gameObject . CompareTag ( "Score" ) ) {
109
- // Debug.Log("You scored!");
110
- gameObject . SendMessage ( "IncrementScore" , 10 ) ;
111
- // if (audio)
112
- // {
113
- // audio.Play();
114
- // }
115
- }
107
+ // function OnTriggerEnter (other : Collider) {
108
+ // if (other.gameObject.CompareTag ("Score")){
109
+ // // Debug.Log("You scored!");
110
+ // gameObject.SendMessage ("IncrementScore", 10);
111
+ // // if (audio)
112
+ // // {
113
+ // // audio.Play();
114
+ // / / }
115
+ // }
116
116
117
- if ( other . gameObject . CompareTag ( "CloudLevelSelect" ) ) {
118
- isLoading = true ;
119
- Camera . main . SendMessage ( "fadeOut" ) ;
120
- yield WaitForSeconds ( 1 ) ;
117
+ // if (other.gameObject.CompareTag ("CloudLevelSelect")){
118
+ // isLoading = true;
119
+ // Camera.main.SendMessage("fadeOut");
120
+ // yield WaitForSeconds(1);
121
121
122
- Application . LoadLevel ( levelToLoad ) ;
123
- }
122
+ // Application.LoadLevel(levelToLoad);
123
+ // }
124
124
125
- if ( other . gameObject . CompareTag ( "SunsetLevelSelect" ) ) {
126
- isLoading = true ;
127
- Camera . main . SendMessage ( "fadeOut" ) ;
128
- yield WaitForSeconds ( 1 ) ;
125
+ // if (other.gameObject.CompareTag ("SunsetLevelSelect")){
126
+ // isLoading = true;
127
+ // Camera.main.SendMessage("fadeOut");
128
+ // yield WaitForSeconds(1);
129
129
130
- Application . LoadLevel ( levelToLoad2 ) ;
131
- }
130
+ // Application.LoadLevel(levelToLoad2);
131
+ // }
132
132
133
- if ( other . gameObject . CompareTag ( "SpaceLevelSelect" ) ) {
134
- isLoading = true ;
135
- Camera . main . SendMessage ( "fadeOut" ) ;
136
- yield WaitForSeconds ( 1 ) ;
133
+ // if (other.gameObject.CompareTag ("SpaceLevelSelect")){
134
+ // isLoading = true;
135
+ // Camera.main.SendMessage("fadeOut");
136
+ // yield WaitForSeconds(1);
137
137
138
- Application . LoadLevel ( levelToLoad3 ) ;
139
- }
138
+ // Application.LoadLevel(levelToLoad3);
139
+ // }
140
140
141
- if ( other . gameObject . CompareTag ( "SkyLevelSelect" ) ) {
142
- isLoading = true ;
143
- Camera . main . SendMessage ( "fadeOut" ) ;
144
- yield WaitForSeconds ( 1 ) ;
141
+ // if (other.gameObject.CompareTag ("SkyLevelSelect")){
142
+ // isLoading = true;
143
+ // Camera.main.SendMessage("fadeOut");
144
+ // yield WaitForSeconds(1);
145
145
146
- Application . LoadLevel ( levelToLoad4 ) ;
147
- }
146
+ // Application.LoadLevel(levelToLoad4);
147
+ // }
148
148
149
- }
149
+ // }
150
150
151
- function OnGUI ( ) {
152
- if ( isLoading ) {
153
- GUI . Label ( Rect ( ( Screen . width / 2 ) - 110 , ( Screen . height / 2 ) - 60 , 400 , 70 ) , "Loading..." , "mainMenuTitle" ) ; }
154
- }
151
+ // function OnGUI() {
152
+ // if (isLoading) {
153
+ // GUI.Label ( Rect( (Screen.width/2)-110, (Screen.height / 2) - 60, 400, 70), "Loading...", "mainMenuTitle"); }
154
+ // }
155
155
156
- @script AddComponentMenu ( "Scripts/FallingPlayerStart" )
156
+ // @script AddComponentMenu("Scripts/FallingPlayerStart")
0 commit comments