Mercurial > hg > Game > Games
comparison Chapter5/Assets/SimpleCloudSystem by RM/SCS.js @ 2:fdab88fc2cb9
add game projects
author | Yuta ANSE <e135745@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2015 23:14:45 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:347d21cdfc22 | 2:fdab88fc2cb9 |
---|---|
1 | |
2 var Player : Transform; | |
3 var CloudsSpeed: float; | |
4 private var distance = 10.0; | |
5 | |
6 private var height = 0; | |
7 private var heightDamping = 0; | |
8 private var rotationDamping = 0; | |
9 | |
10 | |
11 | |
12 function Update() { | |
13 transform.Rotate(0,Time.deltaTime*CloudsSpeed ,0); | |
14 // rotate 90 degrees around the object's local Y axis: | |
15 } | |
16 | |
17 function LateUpdate () { | |
18 | |
19 | |
20 | |
21 if (!Player) | |
22 return; | |
23 | |
24 var wantedHeight = Player.position.y + height; | |
25 | |
26 var currentHeight = transform.position.y; | |
27 | |
28 currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime); | |
29 | |
30 transform.position = Player.position; | |
31 | |
32 transform.position.y = currentHeight; | |
33 | |
34 } |