public void ConvertNumToImg(string mod, int num) { if (mod == "yi") { if (num > 99) { yi_shiwei.spriteName = "9"; yi_gewei.spriteName = "9"; } else { int coinShiWei = (int)((float)num / 10.0f); yi_shiwei.spriteName = coinShiWei.ToString(); yi_gewei.spriteName = (num % 10).ToString(); } if (num >= GlobalData.GetInstance().XUTOUBI) { if ((StartBtCtrl.GetInstanceP2() != null && !StartBtCtrl.GetInstanceP2().CheckIsActivePlayer()) && (GameOverCtrl.GetInstance() != null && !GameOverCtrl.GetInstance().CheckIsActiveOver()) && (FinishPanelCtrl.GetInstance() != null && !FinishPanelCtrl.GetInstance().CheckIsActiveFinish())) { InsertCoinCtrl.GetInstanceP2().HiddenInsertCoin(); StartBtCtrl.GetInstanceP2().InitStartBtCartoon(); } } } else if (mod == "xu") { xu_shiwei.spriteName = (num / 10).ToString(); xu_gewei.spriteName = (num % 10).ToString(); } }
public void ActivePlayerOne() { if (IsActivePlayer) { return; } if (DaoJiShiCtrl.TimeVal <= 1) { return; } if (FinishPanelCtrl.GetInstance().CheckIsActiveFinish()) { return; } bool isEnablePlayer = false; PlayHitStartBtAudio(); if (!GlobalData.GetInstance().IsFreeMode) { if (GlobalData.GetInstance().Icoin >= GlobalData.GetInstance().XUTOUBI) { StartBtCtrl.GetInstanceP2().InitStartBtCartoon(); } else { InsertCoinCtrl.GetInstanceP2().ShowInsertCoin(); } HeadCtrlPlayer.GetInstanceP1().StopColor(); isEnablePlayer = true; } else { HeadCtrlPlayer.GetInstanceP1().StopColor(); HeadCtrlPlayer.GetInstanceP2().PlayColor(); StartBtCtrl.GetInstanceP2().InitStartBtCartoon(); isEnablePlayer = true; } if (isEnablePlayer) { IsActivePlayer = true; CloseStartBtCartoon(); if (GlobalData.GetInstance().gameMode == GameMode.SoloMode) { ActiveDaJuCtrl.GetInstanceP1().ActivePlayerBlood(true); DaoJiShiCtrl.GetInstance().StopDaoJiShi(); GameOverCtrl.GetInstance().HiddenContinueGame(); GameTimeCtrl.GetInstance().InitPlayGameTime(1); //GameCtrlXK.GetInstance().InitFillPlayerBlood(); } } }
void InitFinishRankBackToMovieScene() { if (HiddenFinishNum == FinishPanelNum.FinishPanel) { FinishPanelCtrl.GetInstance().InitHiddenFinishPanel(); } else { FinishPanelCtrl.GetInstancePlayer().InitHiddenFinishPanel(); } }
IEnumerator PlayDaoJiShi() { if (TimeVal < 1) { StopDaoJiShi(); StartBtCtrl.GetInstanceP1().CloseStartBtCartoon(); //close player startBt cartoon if (GlobalData.GetInstance().gameMode == GameMode.SoloMode) { GameOverCtrl.GetInstance().HiddenContinueGame(); GameOverCtrl.GetInstance().ShowGameOverImg(); //FinishPanelCtrl.GetInstance().ShowFinishPanel(); //Show Finish Panel } else { IsStopCheckAddSpeed = true; GameCtrlXK.IsStopMoveAiPlayer = true; WaterwheelPlayerNetCtrl.GetInstance().ResetPlayerInfo(); if (WaterwheelPlayerNetCtrl.GetInstance().GetPlayerRankNo() == 1) { FinishPanelCtrl.GetInstance().ShowFinishPanel(); } else { //show finishPanelPlayer FinishPanelCtrl.GetInstancePlayer().ShowFinishPanel(); } } yield break; } AudioManager.Instance.PlaySFX(AudioListCtrl.GetInstance().AudioGameDaoJiShi); DaoJiShiSprite.spriteName = DaoJiShiName + TimeVal.ToString(); yield return(new WaitForSeconds(1f)); TimeVal--; yield return(StartCoroutine("PlayDaoJiShi")); }
void BackMovieScene() { FinishPanelCtrl.GetInstance().Invoke("InitHiddenFinishPanel", 2.0f); }
IEnumerator PlayGameTime() { if (FinishPanelCtrl.GetInstance() != null && FinishPanelCtrl.GetInstance().CheckIsActiveFinish()) { StopRunGameTime(); yield break; } if (Time.timeScale != 1f) { yield return(new WaitForSeconds(1.0f)); yield return(StartCoroutine(PlayGameTime())); } SetTimeValToImg(); if (GameTimeValCur <= 0 && !AddGameTimeCtrl.GetInstance().GetIsActiveAddTime()) { InsertCoinCtrl.GetInstanceP2().HiddenInsertCoin(); StartBtCtrl.GetInstanceP2().CloseStartBtCartoon(); HeadCtrlPlayer.GetInstanceP1().SetHeadColor(); HeadCtrlPlayer.GetInstanceP2().SetHeadColor(); ResetTimeHMvalToImg(); StopCoroutine(SetTimeHMvalToImg()); StopCoroutine(PlayGameTime()); IsInitPlayTime = false; StartBtCtrl.GetInstanceP1().ResetIsActivePlayer(); StartBtCtrl.GetInstanceP2().ResetIsActivePlayer(); if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode) { gameObject.SetActive(false); RankingCtrl.GetInstance().StopCheckPlayerRank(); //FinishPanelCtrl.GetInstancePlayer().ShowFinishPanel(); if (WaterwheelPlayerNetCtrl.GetInstance().GetPlayerRankNo() == 1) { FinishPanelCtrl.GetInstance().ShowFinishPanel(); } else { FinishPanelCtrl.GetInstancePlayer().ShowFinishPanel(); } } else { GameOverCtrl.GetInstance().ShowContinueGame(); DaoJiShiCtrl.GetInstance().InitPlayDaoJiShi(); } yield break; } yield return(new WaitForSeconds(1.0f)); if (GameTimeValCur <= 10 && GameTimeValCur >= 1 && !TimeTTran.enabled) { TimeTTran.ResetToBeginning(); TimeTTran.enabled = true; TimeTTran.PlayForward(); if (GameTimeValCur == 10) { GameDaoJiShiCtrl.GetInstance().StartPlayDaoJiShi(); CreateAudioSourceTime(); AudioSourceTime.Play(); } } if (!AddGameTimeCtrl.GetInstance().GetIsActiveAddTime()) { GameTimeValCur--; } if (GameTimeValCur <= 0 && TimeTTran.enabled) { TimeTTran.enabled = false; if (AudioSourceTime != null && AudioSourceTime.isPlaying) { AudioSourceTime.Stop(); } } yield return(StartCoroutine(PlayGameTime())); }
void checkPlayerMoveDir() { if (IsCheckMoreNextPath) { CheckMoreNextPathDir(); return; } if (AimMarkTran == null) { return; } Vector3 vecA = AimMarkTran.forward; Vector3 vecB = AimMarkTran.position - PlayerTran.position; Vector3 vecC = PlayerTran.forward; vecA.y = vecB.y = vecC.y = 0f; float cosAC = Vector3.Dot(vecA, vecC); float cosAB = Vector3.Dot(vecA, vecB); float cosBC = Vector3.Dot(vecB, vecC); if (cosAC < 0f && cosBC < 0f && !GameOverCtrl.GetInstance().CheckIsActiveOver()) { if (!IsDonotTurnRight && !IsDonotTurnLeft && (AutoFireScript.PathKeyState == 0 || IntoPuBuCtrl.IsIntoPuBu || PlayerAutoFire.IsRestartMove)) { if (bIsTurnRight) { IsDonotTurnRight = true; IsDonotTurnLeft = false; } else if (bIsTurnLeft) { IsDonotTurnRight = false; IsDonotTurnLeft = true; } } SetIsDirWrong(true); } else { IsDonotTurnRight = false; IsDonotTurnLeft = false; SetIsDirWrong(false); if (cosBC <= 0f && cosAB <= 0f) { ParentPath = AimMarkTran.parent; //next path AiMark markScript = AimMarkTran.GetComponent <AiMark>(); if (markScript == null) { return; } mBakeTimePointPos = AimMarkTran.position; mBakeTimePointRot = AimMarkTran.forward; AutoFireScript.SetPlayerPreMark(AimMarkTran); int conutTmp = AimMarkTran.parent.childCount - 1; int markCount = markScript.getMarkCount(); AimMarkTran = markScript.mNextMark; if (markCount == conutTmp) { if (AimMarkTran == null) { //player run to end this.enabled = false; // IsRunToEndPoint = true; DaoJiShiCtrl.GetInstance().StopDaoJiShi(); GameOverCtrl.GetInstance().HiddenContinueGame(); FinishPanelCtrl.GetInstance().ShowFinishPanel(); AutoFireScript.SetPlayerMvSpeed(0f); //AutoFireScript.CloseWaterParticle(); return; } AiPathCtrlTran = AimMarkTran.parent; //next path AutoFireScript.SetPathKeyState(AiPathCtrlTran.GetComponent <AiPathCtrl>()); if (ParentPath != null) { AiParentPathScript = ParentPath.GetComponent <AiPathCtrl>(); if (AiParentPathScript.GetNextPathNum() > 1) { IsCheckMoreNextPath = true; } } } } } }
void CheckMoreNextPathDir() { if (AiParentPathScript == null) { return; } bool isDirRight = false; //int [] DirTag = new int[3]; //DirTag: 0 -> dir is wrong, 1 -> dir is right. Transform [] aimMarkTranArray = new Transform[3]; aimMarkTranArray[0] = AiParentPathScript.mNextPath1; aimMarkTranArray[1] = AiParentPathScript.mNextPath2; aimMarkTranArray[2] = AiParentPathScript.mNextPath3; Transform aimMarkTran = null; Vector3 vecA = Vector3.zero; Vector3 vecB = Vector3.zero; Vector3 vecC = Vector3.zero; float cosAC = 0f; float cosAB = 0f; float cosBC = 0f; for (int i = 0; i < 3; i++) { if (aimMarkTranArray[i] == null) { continue; } aimMarkTran = aimMarkTranArray[i].GetChild(0); if (aimMarkTran == null) { continue; } vecA = aimMarkTran.forward; vecB = aimMarkTran.position - PlayerTran.position; vecC = PlayerTran.forward; vecA.y = vecB.y = vecC.y = 0f; cosAC = Vector3.Dot(vecA, vecC); cosAB = Vector3.Dot(vecA, vecB); cosBC = Vector3.Dot(vecB, vecC); if (cosAC < 0f && cosBC < 0f) { //dir is wrong. } else { isDirRight = true; float disAB = Vector3.Distance(vecB, Vector3.zero); if (cosAB <= 0f && disAB < 15f) { IsCheckMoreNextPath = false; ParentPath = aimMarkTran.parent; AimMarkTran = aimMarkTran; AiMark markScript = AimMarkTran.GetComponent <AiMark>(); if (markScript == null) { continue; } mBakeTimePointPos = AimMarkTran.position; mBakeTimePointRot = AimMarkTran.forward; AutoFireScript.SetPlayerPreMark(AimMarkTran); int conutTmp = AimMarkTran.parent.childCount - 1; int markCount = markScript.getMarkCount(); AimMarkTran = markScript.mNextMark; AiPathCtrlTran = AimMarkTran.parent; AutoFireScript.SetPathKeyState(AiPathCtrlTran.GetComponent <AiPathCtrl>()); if (markCount == conutTmp) { if (AimMarkTran == null) { //player run to end this.enabled = false; DaoJiShiCtrl.GetInstance().StopDaoJiShi(); GameOverCtrl.GetInstance().HiddenContinueGame(); FinishPanelCtrl.GetInstance().ShowFinishPanel(); AutoFireScript.SetPlayerMvSpeed(0f); //AutoFireScript.CloseWaterParticle(); return; } AiPathCtrlTran = AimMarkTran.parent; //next path AutoFireScript.SetPathKeyState(AiPathCtrlTran.GetComponent <AiPathCtrl>()); if (ParentPath != null) { AiParentPathScript = ParentPath.GetComponent <AiPathCtrl>(); if (AiParentPathScript.GetNextPathNum() > 1) { IsCheckMoreNextPath = true; } } } return; } } } if (isDirRight && !AutoFireScript.CheckPlayerIsMoveDirWrong()) { IsDonotTurnRight = false; IsDonotTurnLeft = false; SetIsDirWrong(false); } else { if (!IsDonotTurnRight && !IsDonotTurnLeft && (AutoFireScript.PathKeyState == 0 || IntoPuBuCtrl.IsIntoPuBu || PlayerAutoFire.IsRestartMove)) { if (bIsTurnRight) { IsDonotTurnRight = true; IsDonotTurnLeft = false; } else if (bIsTurnLeft) { IsDonotTurnRight = false; IsDonotTurnLeft = true; } } SetIsDirWrong(true); } }