void GetInput() { float steerTmp = 0f; if (mGameTime > 0) { steerTmp = pcvr.mGetSteer; } else { MouseDownCountP_1 = 0f; MouseDownCountP_2 = 0f; } //Debug.Log("MouseDownCountP_1 " + MouseDownCountP_1 + ", MouseDownCountP_2 " + MouseDownCountP_2); if (IsActiveBingLu) { steerTmp *= 3f; if (steerTmp > 1f) { steerTmp = 1f; } } mSteer = steerTmp; if (Mathf.Abs(mSteer) < 0.1f) { mSteer = 0f; } float rotSpeed = PlayerZhuanXiangVal * mSteer * Time.smoothDeltaTime; if (mSteer > 0f && !IsDonotTurnRight) { if (mSteer - OldSteer > 0f) { mSteerTimeCur += GameCtrlXK.GetInstance().PlayerSteerKey *maxSteerTime; if (mSteerTimeCur > maxSteerTime) { mSteerTimeCur = maxSteerTime; } } else if (mSteer - OldSteer < 0f) { mSteerTimeCur -= GameCtrlXK.GetInstance().PlayerSteerKey *maxSteerTime; if (mSteerTimeCur < 0f) { mSteerTimeCur = 0f; } } OldSteer = mSteer; if (TengManInfoCtrl.GetInstance().GetIsActiveTengManInfo()) { PlayerTran.Rotate(0, -rotSpeed, 0); } else { PlayerTran.Rotate(0, rotSpeed, 0); } bIsTurnLeft = false; if (!bIsTurnRight) { bIsTurnRight = true; PlayerAutoFire.ActiveIsTurnRight(); if (mSpeed > 15f && !pcvr.IsPlayerHitShake) { pcvr.OpenQiNangZuo(); pcvr.CloseQiNangYou(); } } if (Mathf.Abs(mSteer) < 0.4f) { bIsTurnRight = false; if (!pcvr.IsPlayerHitShake) { pcvr.CloseQiNangZuo(); } } } else if (mSteer < 0f && !IsDonotTurnLeft) { if (mSteer - OldSteer > 0f) { mSteerTimeCur += GameCtrlXK.GetInstance().PlayerSteerKey *maxSteerTime; if (mSteerTimeCur > 0f) { mSteerTimeCur = 0f; } } else if (mSteer - OldSteer < 0f) { mSteerTimeCur -= GameCtrlXK.GetInstance().PlayerSteerKey *maxSteerTime; if (mSteerTimeCur < -maxSteerTime) { mSteerTimeCur = -maxSteerTime; } } OldSteer = mSteer; if (TengManInfoCtrl.GetInstance().GetIsActiveTengManInfo()) { PlayerTran.Rotate(0, -rotSpeed, 0); } else { PlayerTran.Rotate(0, rotSpeed, 0); } bIsTurnRight = false; if (!bIsTurnLeft) { bIsTurnLeft = true; PlayerAutoFire.ActiveIsTurnLeft(); if (mSpeed > 15f && !pcvr.IsPlayerHitShake) { pcvr.OpenQiNangYou(); pcvr.CloseQiNangZuo(); } } if (Mathf.Abs(mSteer) < 0.4f) { bIsTurnLeft = false; if (!pcvr.IsPlayerHitShake) { pcvr.CloseQiNangYou(); } } } else { OldSteer = 0f; mSteerTimeCur = 0f; PlayerAutoFire.ResetIsTurn(); bIsTurnLeft = false; bIsTurnRight = false; } ChuanShenScript.UpdateChuanShenAction(bIsTurnLeft, bIsTurnRight); ZhuJiaoNanScript.UpdateZhuJiaoNanAction(bIsTurnLeft, bIsTurnRight); float maxAngle = 15f; Vector3 rotationA = PlayerTran.localEulerAngles; if (AutoFireScript.CheckPlayerDownIsHit()) { rotationA = PlayerTran.localEulerAngles; } float angleZ = -(mSteerTimeCur * maxAngle) / maxSteerTime; if (angleZ < -maxAngle) { angleZ = -maxAngle; } else if (angleZ > maxAngle) { angleZ = maxAngle; } rotationA.z = angleZ; if (CartoonShootPlayerCtrl.IsActiveRunPlayer) { return; } PlayerTran.localEulerAngles = rotationA; }
///<summary> /// player hit obj key -> 0, player shooting obj key -> 1 ///</summary> void HandleHitShootObj(GameObject obj, int key) { switch (obj.tag) { case "TengManObj": if (key == 0) { TengManInfoCtrl.GetInstance().ShowTengManInfo(); } break; case "FuBingObj": if (key == 0) { ActiveIsHitFuBingObj(); } break; case "IntoBingLu": if (key == 0) { ActiveBingLuTrigger(); } break; case "OutBingLu": if (key == 0) { CloseBingLuTrigger(); } break; case "HuanWeiFuObj": ActiveDaJuCtrl.SetTypeDaoJuList((int)DaoJuTypeIndex.huanWeiFu, 1); GameCtrlXK.GetInstance().ActivePlayerDaoJuType((int)DaoJuTypeIndex.huanWeiFu); ShowDaoJuExplosion(obj); HitHuanWeiFuObj(); break; case "HuanYingFuObj": ActiveDaJuCtrl.SetTypeDaoJuList((int)DaoJuTypeIndex.huanYingFu, 1); GameCtrlXK.GetInstance().ActivePlayerDaoJuType((int)DaoJuTypeIndex.huanYingFu); ShowDaoJuExplosion(obj); NengLiangQuanCtrl.GetInstance().MoveNengLiangQuanToEnd(DaoJuTypeIndex.huanYingFu); DaoJuTiShiCtrl.GetInstance().ShowDaoJuTiShi(DaoJuState.HuanYingFu); PlayerZhuanXiangVal = GameCtrlXK.PlayerZhuanXiangJSVal; break; case "JuLiFuObj": ActiveDaJuCtrl.SetTypeDaoJuList((int)DaoJuTypeIndex.juLiFu, 1); GameCtrlXK.GetInstance().ActivePlayerDaoJuType((int)DaoJuTypeIndex.juLiFu); ShowDaoJuExplosion(obj); ActiveJuLiFuState(); DaoJuTiShiCtrl.GetInstance().ShowDaoJuTiShi(DaoJuState.JuLiFu); break; case "DianDaoFuObj": ActiveDaJuCtrl.SetTypeDaoJuList((int)DaoJuTypeIndex.dianDaoFu, 1); GameCtrlXK.GetInstance().ActivePlayerDaoJuType((int)DaoJuTypeIndex.dianDaoFu); ShowDaoJuExplosion(obj); HitDianDaoFuObj(); break; case "DingShenFuObj": ActiveDaJuCtrl.SetTypeDaoJuList((int)DaoJuTypeIndex.dingShenFu, 1); GameCtrlXK.GetInstance().ActivePlayerDaoJuType((int)DaoJuTypeIndex.dingShenFu); ShowDaoJuExplosion(obj); HitDingShenFuObj(); break; } }