// Update is called once per frame void Update() { now_x = transform.position.x; now_z = transform.position.z; if (isalive == 1 && !ground [ground_index].IsInPoint(now_x, now_z)) { if (!ground [1 - ground_index].IsInPoint(now_x, now_z)) { speed = 0; isalive = 0; ui_gameSystem.ActiveContinuePanel(true); } else { if (mapIndex == mapSize - 1 && !GlobalMap.GetWinFlag()) { speed = 0; isalive = 0; myCamera.transform.position = new Vector3((min_x + max_x) >> 1, 300, (min_z + max_z) >> 1); myCamera.transform.rotation = Quaternion.Euler(new Vector3(90, 0, 0)); GlobalMap.SetWinFlag(1); ui_gameSystem.ActiveEndPanel(true); //Debug.Log ("ENDENDEND"); } else { if (map [mapIndex].materialType == 2) { resurrectionIndex = mapIndex; resurrectionPoint.Set(ground [ground_index]); lastScore = nowScore; } if (now_x > max_x) { max_x = (int)now_x; } if (now_x < min_x) { min_x = (int)now_x; } if (now_z > max_z) { max_z = (int)now_z; } if (now_z < min_z) { min_z = (int)now_z; } mapIndex++; GlobalMap.ChangeDxy(map [mapIndex].dxDz, out dx, out dz); //ChangeDxy (); //Debug.Log ("dx:"+dx+" dz:"+dz); ground_index = 1 - ground_index; ground [1 - ground_index].Set(ground [ground_index]); ground [1 - ground_index].Updata(dx, dz); //Debug.Log ("dx:"+dx+" dz:"+dz); //Debug.Log ("now_x:"+ now_x+" now_z:"+ now_z); //Debug.Log ("x0:"+ground [ground_index].x+" z0:"+ground [ground_index].z+" x1:"+ground [1 - ground_index].x+" z1:"+ground [1 - ground_index].z); speed += 0.1; nowScore += 10; tmpScore = nowScore - 5; } } } else { if (dx != 0) { tmpScore = nowScore + (int)((transform.position.x - ground [ground_index].x) * 10 / dx); } else { tmpScore = nowScore + (int)((transform.position.z - ground [ground_index].z) * 10 / dz); } } ui_gameSystem.ScoreTextUpdate(tmpScore); if (scoreQueue.Count > 0) { scoreTransform = scoreQueue.Peek().transform; if (GlobalMap.ReachTest(scoreTransform, this.transform)) { speed = spee_default; Destroy(scoreQueue.Peek()); //Debug.Log ("this:"+this.transform.position.x+" " + this.transform.position.z); //Debug.Log ("score:"+scoreTransform.position.x+" " + scoreTransform.position.z); //Debug.Log ("dx:"+dx+" dz:"+dz); Debug.Log("reach"); scoreQueue.Dequeue(); } else if (GlobalMap.OverTest(this.transform, scoreTransform, dx, dz)) { //Debug.Log ("this:"+this.transform.position.x+" " + this.transform.position.z); //Debug.Log ("score:"+this.scoreTransform.position.x+" " + this.scoreTransform.position.z); //Debug.Log ("dx:"+dx+" dz:"+dz); Debug.Log("over"); Destroy(scoreQueue.Peek(), 2); scoreQueue.Dequeue(); } } if (!GlobalMap.GetWinFlag()) { transform.Translate(Vector3.forward * (float)speed * Time.deltaTime, Space.Self); } while (groundQueue.Count > 0 && ground [ground_index].IsInPoint(groundQueue.Peek().transform.position.x, groundQueue.Peek().transform.position.z)) { groundQueue.Dequeue(); } }