fly bird 사례 코드bird

3315 단어
 1 using UnityEngine;
 2 using System.Collections;
 3 
 4 public class bird : MonoBehaviour {
 5     public float timer = 0;
 6     public int freamNumbuer = 10;
 7     public int freamCount=0;
 8 
 9     void Update() {
10         //    
11         if (GameMangger._intance.GameState == GameMangger.GAMESTATE_RUNING)
12         {
13             {
14                 timer += Time.deltaTime;
15                 if (timer >= 1.0f / freamNumbuer)
16                 {
17                     freamCount++;
18                     timer -= 1.0f / freamNumbuer;
19                     int freamIndex = freamCount % 3;
20                     this.renderer.material.SetTextureOffset("_MainTex", new Vector2(0.3333f * freamIndex, 0));
21                 }
22             }
23         }
24 
25         //            
26         if (GameMangger._intance.GameState == GameMangger.GAMESTATE_RUNING)
27         {
28             {
29                 if (Input.GetMouseButtonDown(0))
30                 {
31                     audio.Play();
32                     Vector3 vel02 = this.rigidbody.velocity;
33                     this.rigidbody.velocity = new Vector3(vel02.x, 3, vel02.z);
34                 }
35             }
36         }
37     }
38     //      
39     public void getLife()
40     {
41         rigidbody.useGravity = true;
42         rigidbody.velocity = new Vector3(3, 0, 0);
43     }
44 }

좋은 웹페이지 즐겨찾기