码迷,mamicode.com
首页 > 其他好文 > 详细

fly bird 案例代码_GameManager

时间:2015-11-08 19:24:12      阅读:317      评论:0      收藏:0      [点我收藏+]

标签:

 1 using UnityEngine;
 2 using System.Collections;
 3 
 4 public class GameMangger : MonoBehaviour {
 5     public static int GAMESTATE_MENU = 0; //游戏菜单状态
 6     public static int GAMESTATE_RUNING = 1;      //游戏运行状态
 7     public static int GAMESTATE_END = 2;    //游戏结束状态
 8     public GameObject bird;
 9 
10     public Transform firstBg;
11     public int score=0;
12     public int GameState = GAMESTATE_MENU;     //默认状态
13     public static  GameMangger _intance;
14 
15     void Start() {
16         _intance = this;
17         bird = GameObject.FindGameObjectWithTag("Player");
18     }
19 
20     void Update() {
21         if (Input.GetMouseButtonDown(0)) {
22             if (GameState == GAMESTATE_MENU) {
23                 GameState = GAMESTATE_RUNING;
24                 bird.SendMessage("getLife");
25             }
26         }
27 
28         if (GameState == GAMESTATE_END) {
29             GameMenu._instance.gameObject.SetActive(true);
30             GameMenu._instance.UpdataScore(score);
31         }
32     }
33 }

 

fly bird 案例代码_GameManager

标签:

原文地址:http://www.cnblogs.com/wry524/p/4947813.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!