public void DeathReset() { //白色已卡住 DeathAfter = true; F_Object.ResetAll(); if (F_Object.HasReseting()) { return; } AfterDeathReset(); }
public void FixedUpdate() { /*debug only*/ if (DebugBool) { DebugBool = false; NextSector(); } /**from late update****/ if (!isPause /* && !birthing*/) { if (!theCamera.FreeCameraPosition && !theCamera.FreeCameraAim) { //键盘监听旋转 if ((Input.GetKeyDown(scoreSaver.Key_Turn) && Input.GetKey(scoreSaver.Key_Left)) || (Input.GetKey(scoreSaver.Key_Turn) && Input.GetKeyDown(scoreSaver.Key_Left))) { JoyListener.LeftR = true; } if ((Input.GetKeyDown(scoreSaver.Key_Turn) && Input.GetKey(scoreSaver.Key_Right)) || (Input.GetKey(scoreSaver.Key_Turn) && Input.GetKeyDown(scoreSaver.Key_Right))) { JoyListener.RightR = true; } //手柄监听旋转 if (JoyListener.LeftR || Input.GetButtonDown("LB")) { JoyListener.LeftR = false; //左转 CameraDirectionAnimator.ResetTrigger("L"); CameraDirectionAnimator.SetTrigger("R"); } if (JoyListener.RightR || Input.GetButtonDown("RB")) { JoyListener.RightR = false; //右转 CameraDirectionAnimator.ResetTrigger("R"); CameraDirectionAnimator.SetTrigger("L"); } } } /******/ //死亡后执行ResetUpdate,回调AfterDeathReset if (DeathBigin && DeathAfter) { if (F_Object.HasReseting()) { F_Object.ResetUpdateAll(); } else { AfterDeathReset(); } } //按Esc或手柄Start开启暂停菜单 if (!isPause && !LevelEnded && !birthing && (Input.GetKeyDown(KeyCode.Escape) || Input.GetButtonDown("Start"))) { Pause(true); } if (!isPause && !birthing && !LevelEnded) { if (Score > 0) { Score -= 2 * Time.deltaTime; } else { Score = 0; } //使用键盘 if (deviceType == (int)DeviceType.Type.KeyBoard) { //控制方向 JoyListener.L.y = Input.GetKey(scoreSaver.Key_Up) ? 1 : Input.GetKey(scoreSaver.Key_Down) ? -1 : 0; JoyListener.L.x = Input.GetKey(scoreSaver.Key_Right) ? 1 : Input.GetKey(scoreSaver.Key_Left) ? -1 : 0; } //视野控制 //这里给LT和RT设置一个小偏移,R摇杆小幅度换视野 Vector3 v3 = Vector3.zero; v3 = Vector3.left * Input.GetAxis("LTrigger") + Vector3.right * Input.GetAxis("RTrigger"); v3.x += JoyListener.R.x * 1; v3 = v3 + CameraDirection.TransformDirection(Vector3.Cross(theCamera.CameraMove, Vector3.right)).normalized *JoyListener.R.y; theCamera.CameraSoftMove = v3; //手柄/键盘抬高视野 if (deviceType == (int)DeviceType.Type.KeyBoard || deviceType == (int)DeviceType.Type.Joystick) { if (Input.GetKey(scoreSaver.Key_OverView) || Input.GetButton("A") || Input.GetButton("R")) { theCamera.CameraSoftMove.y += 10;//上方有对y的控制,这里不宜直接修改 } } //屏幕键盘抬高视野 else if (deviceType == (int)DeviceType.Type.TouchScreen && JoyListener.OverView) { theCamera.CameraSoftMove.y += 10; } } }