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 }
时间: 2024-11-06 09:37:19