public override void enter() { Debug.Log("GameOverState enter!"); pc = PanelCenter.Instance; //scoreBoard = ScoreBoard.Instance; //scoreBoard.SetScoreList(score); pc.showGameOverPanel(); }
void Update() { if (currentFruit != null) { //判断当前是否有水果,如果有的话执行下面的代码,如果没有就判断是否点击了gameover /*检测玩家与左右手位置*/ if (KinectManager.Instance.IsUserDetected()) { //检测到玩家 //long userId = KinectManager.Instance.GetPrimaryUserID ();//获取玩家id //Vector2 userPos = KinectManager.Instance.GetUserPosition(userId);//获取整个玩家相对于体感的坐标信息 /*判断是否检测到右手*/ List <long> players = new List <long>(); players = KinectManager.Instance.GetUsersIdByNum(playerNumber); int jointRightType = (int)KinectInterop.JointType.HandRight; //表示右手 int jointLeftType = (int)KinectInterop.JointType.HandLeft; //表示左手 foreach (long userId in players) { if (KinectManager.Instance.IsJointTracked(userId, jointRightType)) { //追踪到关节点 Vector3 HandPos = KinectManager.Instance.GetJointKinectPosition(userId, jointRightType); //获取右手信息 rightTrail[players.IndexOf(userId)].position = HandPos; //Vector3 HandScreenPos = Camera.main.WorldToScreenPoint (HandPos);//右手转换到屏幕坐标 //Vector2 HandScrPos = new Vector2 (HandScreenPos.x, HandScreenPos.y);//三维坐标转换到二维 //KinectInterop.HandState rightHandState = KinectManager.Instance.GetRightHandState(userId);rightHandState == KinectInterop.HandState.Open && } /*判断是否检测到左手*/ //int jointLeftType = (int)KinectInterop.JointType.HandLeft;//表示左手 if (KinectManager.Instance.IsJointTracked(userId, jointLeftType)) { //追踪到关节点 Vector3 HandPos = KinectManager.Instance.GetJointKinectPosition(userId, jointLeftType); //获取左手信息 leftTrail[players.IndexOf(userId)].position = HandPos; //Vector3 HandScreenPos = Camera.main.WorldToScreenPoint (HandPos);//右手转换到屏幕坐标 //Vector2 HandScrPos = new Vector2 (HandScreenPos.x, HandScreenPos.y);//三维坐标转换到二维 //KinectInterop.HandState leftHandState = KinectManager.Instance.GetLeftHandState(userId);leftHandState == KinectInterop.HandState.Open && } } } /*显示生命值与分数*/ //lifeContent.setLife(lifeNum); //scoreTxt.text = scoreNum+""; /*判断生命值是否为0 如果为0 判断之前产生的水果number 是否为0 如果为0创建多个水果*/ if (lifeControl.gameObject.GetComponent <LifeNumControl>().lifeNum > 0) { if (!IsInvoking("createMulFruit")) { Invoke("createMulFruit", 2); } panelCenter.scoreNum = lifeControl.gameObject.GetComponent <ScoreControl>().score; } else { /* * if(GameObject.FindWithTag("PlayOver") == null){ * createPlayOver(); * } * gameOverImg.gameObject.SetActive(true);*/ CancelInvoke("createMulFruit"); panelCenter.showGameOverPanel(); Destroy(gameObject); } } //detectedClickGameOver (); }
public override void enter() { pc = PanelCenter.Instance; pc.showGameOverPanel(); }