// Use this for initialization void Start() { int count = transform.childCount; for (int i = 0; i < count; i++) { Transform mark = transform.GetChild(i); AiMark markScript = mark.GetComponent <AiMark>(); markScript.setMarkCount(i); if (i < (count - 1)) { markScript.mNextMark = transform.GetChild(i + 1); } else { if (mNextPath1 != null && mNextPath1.childCount > 0) { markScript.mNextMark = mNextPath1.GetChild(0); } else if (mNextPath2 != null && mNextPath2.childCount > 0) { markScript.mNextMark = mNextPath2.GetChild(0); } } } AiPathCtrl aiPath = gameObject.GetComponent <AiPathCtrl>(); aiPath.enabled = false; }
void OnDrawGizmosSelected() { if (!XkGameCtrl.IsDrawGizmosObj) { return; } if (!enabled) { return; } if (!IsTestDrawPath || AiPathScript == null) { return; } AiPathCtrl pathScript = AiPathScript; if (!pathScript.enabled) { pathScript.enabled = true; } pathScript.DrawPath(); }
bool MovePlayerOnCompelteITween() { MarkCount++; Transform pathTran = AiPathScript.transform; if (MarkCount >= pathTran.childCount) { if (AiPathScript.mNextPath1 == null) { switch (PlayerSt) { case PlayerTypeEnum.FeiJi: Debug.Log("Unity:" + "FeiJiPlayer move to end position"); break; case PlayerTypeEnum.TanKe: //Debug.Log("Unity:"+"TanKePlayer move to end position"); break; } return(false); } MarkCount = 0; AiPathScript = AiPathScript.mNextPath1.GetComponent <AiPathCtrl>(); //Debug.Log("Unity:"+"move next path, path is "+AiPathScript.name); } MovePlayerByItween(); return(true); }
public void SetHuanWeiFuActiveInfo(int countPath, int countMark) { if (IsActiveHuanWeiPos) { return; } IsActiveHuanWeiPos = true; AiPathCtrlTran = AiPathGroupCtrl.FindAiPathTran(countPath); StartMarkCount = countMark; if (AiPathCtrlTran != null) { AimMarkTran = AiPathCtrlTran.GetChild(StartMarkCount); AiMark markAimScript = AimMarkTran.GetComponent <AiMark>(); AiPathCtrl pathScript = AiPathCtrlTran.GetComponent <AiPathCtrl>(); SetPlayerAimMarkData(pathScript.PathIndex, markAimScript.getMarkCount(), PlayerTran.name); } iTween itweenScript = GetComponent <iTween>(); if (itweenScript != null) { itweenScript.isRunning = false; Destroy(itweenScript); } Invoke("MoveAiPlayerByItween", 0.05f); }
void OnDrawGizmosSelected() { if (!XkGameCtrl.IsDrawGizmosObj) { return; } if (!enabled) { return; } CheckBoxCollider(); CheckPathMarkScale(); Transform parTran = transform.parent; if (parTran == null) { return; } AiPathCtrl pathScript = parTran.GetComponent <AiPathCtrl>(); if (!pathScript.enabled) { if (!IsTestDrawPath) { if (!IsInitMarkInfo) { pathScript.enabled = true; } else { return; } } else { pathScript.enabled = true; } } else { if (!IsTestDrawPath) { if (IsInitMarkInfo) { pathScript.enabled = false; } } } pathScript.DrawPath(); }
public void ExitPlayerLoopPath() { //Debug.Log("Unity:"+"ExitPlayerLoopPath***"); if (AiPathScript.mNextPath1 == null) { Debug.Log("Unity:" + "Player move to end position"); return; } AiPathScript = AiPathScript.mNextPath1.GetComponent <AiPathCtrl>(); MovePlayerByItween(); }
void checkPlayerMoveDir() { if (IsActiveHuanWeiPos) { return; } if (AimMarkTran == null) { return; } Vector3 posA = AimMarkTran.position; Vector3 posB = PlayerTran.position; posA.y = posB.y = 0f; Vector3 vecB = posA - posB; if (Vector3.Distance(posA, posB) > 18f) { return; } Vector3 vecA = AimMarkTran.forward; vecA.y = vecB.y = 0f; float cosAB = Vector3.Dot(vecA, vecB); if (cosAB <= 0f) { AiMark markScript = AimMarkTran.GetComponent <AiMark>(); if (markScript == null) { return; } int conutTmp = AimMarkTran.parent.childCount - 1; int markCount = markScript.getMarkCount(); if (markCount != conutTmp) { AimMarkTran = markScript.mNextMark; } if (AimMarkTran != null) { AiMark markAimScript = AimMarkTran.GetComponent <AiMark>(); AiPathCtrl pathScript = AiPathCtrlTran.GetComponent <AiPathCtrl>(); SetPlayerAimMarkData(pathScript.PathIndex, markAimScript.getMarkCount(), PlayerTran.name); UpdateAiPlayerAction(); } } }
public void MakePlayerMoveToAiMark(AiMark script) { IsMoveToAiMark = true; Transform markTran = script.transform; transform.position = markTran.position; transform.rotation = markTran.rotation; MarkCount = script.getMarkCount(); AiPathScript = markTran.parent.GetComponent <AiPathCtrl>(); InitMovePlayerByMarkSpeed(); IsMoveToAiMark = false; }
void SetPlayerAimMarkData(int aimPathId, int markId, string playerName) { RankingCtrl.GetInstance().SetPlayerAimMark(aimPathId, markId, playerName); if (Network.peerType != NetworkPeerType.Disconnected && MoveCameraByPath.IsMovePlayer && GlobalData.GetInstance().gameLeve == GameLeve.WaterwheelNet) { netView.RPC("SendAiPlayerAimMarkToOther", RPCMode.OthersBuffered, aimPathId, markId, playerName); AiPathCtrl pathScript = AiPathCtrlTran.GetComponent <AiPathCtrl>(); netView.RPC("SendAiPlayerPathMark", RPCMode.OthersBuffered, pathScript.PathIndex, markId); } }
public void SetBikeAimMark(string aimPathName, int id, string objName) { if (aimPathName == "" || objName == "") { return; } GameObject pathObj = GameObject.Find(aimPathName); if (pathObj == null) { return; } AiPathCtrl pathScript = pathObj.GetComponent <AiPathCtrl>(); if (pathScript == null) { return; } Transform path = pathObj.transform; if (path == null) { return; } if (id < 0 || id >= path.childCount) { return; } Transform tranAim = path.GetChild(id); int max = mRankPlayer.Length; for (int i = 0; i < max; i++) { if (mRankPlayer[i].Name == objName) { mRankPlayer[i].mBikeAimMark = tranAim; mRankPlayer[i].mBikePathKey = pathScript.KeyState; if (mRankPlayer[i].AiNetScript != null) { mRankPlayer[i].AiNetScript.SetAimMark(tranAim); } break; } } }
public void OnDrawPlayerPath() { if (AiPathScript == null) { return; } AiPathCtrl pathScript = AiPathScript; if (!pathScript.enabled) { pathScript.enabled = true; } pathScript.DrawPath(); }
void OnDrawGizmosSelected() { if (!enabled) { return; } if (AiPathMark != null) { Transform AiPathTran = AiPathMark.transform.parent; AiPathCtrl pathScript = AiPathTran.GetComponent <AiPathCtrl>(); pathScript.DrawPath(); } if (NpcPathCtrl != null) { Transform NpcMarkTran = NpcPathCtrl.transform.GetChild(0); NpcMark NpcMarkScript = NpcMarkTran.GetComponent <NpcMark>(); NpcMarkScript.DrawPath(); } if (NpcPathCtrl != null || AiPathMark != null) { Transform [] tranArray = new Transform[2]; if (NpcPathCtrl == null && AiPathMark != null) { tranArray[0] = transform; tranArray[1] = AiPathMark.transform; iTween.DrawPath(tranArray, Color.yellow); } else if (NpcPathCtrl != null) { tranArray[0] = transform; tranArray[1] = NpcPathCtrl.transform.GetChild(0); iTween.DrawPath(tranArray, Color.yellow); if (AiPathMark != null) { tranArray[0] = NpcPathCtrl.transform.GetChild(NpcPathCtrl.transform.childCount - 1); tranArray[1] = AiPathMark.transform; iTween.DrawPath(tranArray, Color.yellow); } } } CheckTransformScale(); UpdateMeshFilter(); }
public void SpawnNetPlayerObj(GameObject playerPrefab, AiPathCtrl pathScript, Vector3 pos, Quaternion rot) { if (Network.peerType == NetworkPeerType.Disconnected) { return; } int playerID = int.Parse(Network.player.ToString()); GameObject obj = (GameObject)Network.Instantiate(playerPrefab, pos, rot, playerID); XkPlayerCtrl playerScript = obj.GetComponent <XkPlayerCtrl>(); playerScript.SetAiPathScript(pathScript); AddNpcObjList(obj); }
bool MovePlayerOnCompelteITween() { MarkCount++; Transform pathTran = AiPathScript.transform; if (MarkCount >= pathTran.childCount) { if (AiPathScript.mNextPath1 == null) { Debug.Log("ZiYouMoveCamera move to end position"); return(false); } MarkCount = 0; AiPathScript = AiPathScript.mNextPath1.GetComponent <AiPathCtrl>(); //Debug.Log("move next path, path is "+AiPathScript.name); } MovePlayerByItween(); return(true); }
void OnDrawGizmosSelected() { if (!enabled) { return; } CheckPathMarkScale(); CheckBoxCollider(); UpdateMeshFilter(); Transform parTran = transform.parent; if (parTran == null) { return; } AiPathCtrl pathScript = parTran.GetComponent <AiPathCtrl>(); pathScript.DrawPath(); }
public void SetAiPathScript(AiPathCtrl script) { IsHandleRpc = true; AiPathScript = script; switch (PlayerSt) { case PlayerTypeEnum.FeiJi: MarkCount = XkGameCtrl.GetInstance().GetFeiJiMarkIndex() - 1; break; case PlayerTypeEnum.TanKe: MarkCount = XkGameCtrl.GetInstance().GetTanKeMarkIndex() - 1; break; case PlayerTypeEnum.CartoonCamera: MarkCount = XkGameCtrl.GetInstance().GetCartoonCamMarkIndex() - 1; MakePlayerFlyToPathMark(); //XkGameCtrl.SetActiveGameWaterObj(true); break; } }
public void SetPlayerAimMark(int aimPathId, int markId, string playerName) { if (aimPathId < 0 || playerName == "") { return; } Transform path = AiPathGroupCtrl.FindAiPathTran(aimPathId); if (path == null) { return; } AiPathCtrl pathScript = path.GetComponent <AiPathCtrl>(); if (pathScript == null) { return; } if (markId < 0 || markId >= path.childCount) { return; } Transform tranAim = path.GetChild(markId); int max = mRankPlayer.Length; for (int i = 0; i < max; i++) { if (mRankPlayer[i] != null && mRankPlayer[i].Name == playerName) { mRankPlayer[i].mPlayerAimMark = tranAim; mRankPlayer[i].mBikePathKey = pathScript.KeyState; break; } } }
void Start() { m_AiPath = gameObject.GetComponentInParent<AiPathCtrl>(); if (m_AiPath.m_AiPathGroup != null) { //统一将主角镜头移动速度修改为普通状态移动速度. MvSpeed = m_AiPath.m_AiPathGroup.m_MoveSpeed; } //MvSpeed = XkGameCtrl.GetInstance().MvSpeed; bool isOutputError = false; if (PlayerAni == ZhiShengJiAction.Null && TimePlayerAni > 0f && MvSpeed > 1f) { Debug.Log("Unity:"+"PlayerAni is null, but MvSpeed is greater than 1f"); isOutputError = true; } if (isOutputError) { GameObject obj = null; obj.name = "null"; } IsInitMarkInfo = true; IsTestDrawPath = false; MeshRenderer mesh = gameObject.GetComponent<MeshRenderer>(); if (mesh != null) { Destroy(mesh); } MeshFilter meshFt = gameObject.GetComponent<MeshFilter>(); if (meshFt != null) { Destroy(meshFt); } CheckPathMarkScale(); }
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); } }
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 CheckNetPlayerRank() { if (IsStopCheckRank) { CancelInvoke("CheckNetPlayerRank"); return; } /*if (Time.frameCount % 100 == 0) { * Debug.Log("*****************"); * }*/ int j = 0; bool isContinue = false; AiPathCtrl pathScriptPar = null; AiPathCtrl pathScriptCh = null; for (int i = 0; i < MaxPlayerRankNum; i++) { if (IsStopCheckRank) { break; } if (mRankPlayer[i].IsRunToEndPoint) { continue; } if (mRankPlayer[i].AimMarkDataScript != null) { mRankPlayer[i].IsPlayer = mRankPlayer[i].AimMarkDataScript.GetIsPlayer(); isContinue = mRankPlayer[i].AimMarkDataScript.GetIsGameOver(); } else { isContinue = true; mRankPlayer[i].IsPlayer = false; } if (isContinue) { isContinue = false; continue; } j = i + 1; if (j > 7) { break; } parentPlayer = mRankPlayer[i].Player; childPlayer = mRankPlayer[j].Player; aimMarkPar = mRankPlayer[i].mPlayerAimMark; aimMarkCh = mRankPlayer[j].mPlayerAimMark; if (parentPlayer == null || childPlayer == null || aimMarkPar == null || aimMarkCh == null) { continue; } int pathKeyP = mRankPlayer[i].mBikePathKey; int pathKeyC = mRankPlayer[j].mBikePathKey; if (pathKeyP < pathKeyC) { /*if(mRankPlayer[i].IsPlayer || mRankPlayer[j].IsPlayer) * { * Debug.Log("***************************1111, IsPlayer_1 " + mRankPlayer[i].IsPlayer + ", IsPlayer_2 " + mRankPlayer[j].IsPlayer); + }*/ UpdateNetPlayerRank(j); break; } else if (pathKeyP > pathKeyC) { continue; } int pathIdPar = aimMarkPar.parent.GetInstanceID(); int pathIdCh = aimMarkCh.parent.GetInstanceID(); if (pathIdPar == pathIdCh) { AiMark markScriptP = aimMarkPar.GetComponent <AiMark>(); AiMark markScriptC = aimMarkCh.GetComponent <AiMark>(); int markCountP = markScriptP.getMarkCount(); int markCountC = markScriptC.getMarkCount(); if (markCountP < markCountC) { /*if(mRankPlayer[i].IsPlayer || mRankPlayer[j].IsPlayer) * { * Debug.Log("***************************2222, IsPlayer_1 " + mRankPlayer[i].IsPlayer + ", IsPlayer_2 " + mRankPlayer[j].IsPlayer); + }*/ UpdateNetPlayerRank(j); break; } else if (markCountP > markCountC) { continue; } } else { pathScriptPar = aimMarkPar.parent.GetComponent <AiPathCtrl>(); pathScriptCh = aimMarkCh.parent.GetComponent <AiPathCtrl>(); if (pathScriptPar.KeyState > pathScriptCh.KeyState) { continue; } else if (pathScriptPar.KeyState < pathScriptCh.KeyState) { UpdateNetPlayerRank(j); break; } } Vector3 vecA = parentPlayer.transform.position - childPlayer.transform.position; Vector3 vecB = aimMarkPar.position - parentPlayer.transform.position; Vector3 vecC = childPlayer.transform.forward; Vector3 vecD = parentPlayer.transform.forward; vecA.y = 0f; vecB.y = 0f; vecC.y = 0f; vecD.y = 0f; vecA = vecA.normalized; vecB = vecB.normalized; vecC = vecC.normalized; vecD = vecD.normalized; float cosDB = Vector3.Dot(vecD, vecB); float cosDC = Vector3.Dot(vecD, vecC); float cosAC = Vector3.Dot(vecA, vecC); if ((cosDB > 0f && cosDC > 0f && cosAC < 0f) || (cosDB <= 0f && cosDC > 0f && cosAC > 0f) || (cosDB <= 0f && cosDC <= 0f && cosAC < 0f)) { /*if(mRankPlayer[i].IsPlayer || mRankPlayer[j].IsPlayer) * { * Debug.Log("*********33333, IsPlayer_1 " + mRankPlayer[i].IsPlayer + ", IsPlayer_2 " + mRankPlayer[j].IsPlayer + ", pathIdPar " + pathIdPar + ", pathIdCh " + pathIdCh); + }*/ UpdateNetPlayerRank(j); break; } //Debug.Log("i = " + i + ", j = " + j); } return; }
public void SetPathKeyState(AiPathCtrl pathScript) { PathKeyState = pathScript.KeyState; }
// Use this for initialization void Start() { ChuanShenScript = GetComponentInChildren <ChuanShenCtrl>(); ZhuJiaoNanScript = GetComponentInChildren <ZhuJiaoNan>(); netView = GetComponent <NetworkView>(); if (AimMarkDataScript == null) { AimMarkDataScript = gameObject.AddComponent <PlayerAimMarkData>(); } PlayerObj = gameObject; PlayerTran = transform; RigObj = GetComponent <Rigidbody>(); RigObj.isKinematic = true; SetRankPlayerArray(); mGameTime = 1000; CreatePlayerNeedObj(); AiPathCtrlTran = GameCtrlXK.GetInstance().AiPathCtrlTran.GetChild(0); AimMarkTran = AiPathCtrlTran.GetChild(0); if (AimMarkTran != null) { AiMark markAimScript = AimMarkTran.GetComponent <AiMark>(); AiPathCtrl pathScript = AiPathCtrlTran.GetComponent <AiPathCtrl>(); SetPlayerAimMarkData(pathScript.PathIndex, markAimScript.getMarkCount(), PlayerTran.name); } mBakeTimePointPos = AimMarkTran.position; mBakeTimePointPos += Vector3.up * 0.5f; mBakeTimePointRot = AimMarkTran.forward; if (GameCtrlXK.GetInstance().PlayerMarkTest != null) { AiPathCtrlTran = GameCtrlXK.GetInstance().PlayerMarkTest.parent; AiMark markScript = GameCtrlXK.GetInstance().PlayerMarkTest.GetComponent <AiMark>(); AimMarkTran = markScript.mNextMark; if (AimMarkTran != null) { AiMark markAimScript = AimMarkTran.GetComponent <AiMark>(); AiPathCtrl pathScript = AiPathCtrlTran.GetComponent <AiPathCtrl>(); SetPlayerAimMarkData(pathScript.PathIndex, markAimScript.getMarkCount(), PlayerTran.name); } TestPosCount++; Transform posTran = GameCtrlXK.GetInstance().PlayerMarkTest; mBakeTimePointRot = posTran.forward; mBakeTimePointRot.y = 0f; switch (TestPosCount) { case 1: mBakeTimePointPos = posTran.position - posTran.right * 9f + mBakeTimePointRot; break; case 2: mBakeTimePointPos = posTran.position + posTran.right * 9f + mBakeTimePointRot; break; case 3: mBakeTimePointPos = posTran.position - posTran.right * 6f + mBakeTimePointRot * 4f; break; case 4: mBakeTimePointPos = posTran.position + posTran.right * 6f + mBakeTimePointRot * 4f; break; case 5: mBakeTimePointPos = posTran.position - posTran.right * 3f + mBakeTimePointRot * 7f; break; case 6: mBakeTimePointPos = posTran.position + posTran.right * 3f + mBakeTimePointRot * 7f; break; case 7: mBakeTimePointPos = posTran.position + mBakeTimePointRot * 10f; TestPosCount = 0; break; } mBakeTimePointPos += Vector3.up * 0.5f; PlayerTran.position = mBakeTimePointPos; PlayerTran.forward = mBakeTimePointRot; } }
void OnFinishMoveAiPlayerByPath() { AiPathCtrl pathScript = AimMarkTran.parent.GetComponent <AiPathCtrl>(); int rv = pathScript.GetNextPathNum(); if (rv > 0) { int key = 0; Transform trNextPath = null; while (trNextPath == null) { int randVal = Random.Range(0, 1000) % 3; switch (randVal) { case 0: trNextPath = pathScript.mNextPath1; break; case 1: trNextPath = pathScript.mNextPath2; break; case 2: trNextPath = pathScript.mNextPath3; break; } key++; if (key > 2) { if (pathScript.mNextPath1 != null) { trNextPath = pathScript.mNextPath1; } else if (pathScript.mNextPath2 != null) { trNextPath = pathScript.mNextPath2; } else if (pathScript.mNextPath3 != null) { trNextPath = pathScript.mNextPath3; } break; } } if (trNextPath != null) { AimMarkTran = trNextPath.GetChild(0); } } else { Invoke("MoveAiPlayerToEndPos", 0.05f); return; } SetPlayerPathCount(); AiPathCtrlTran = AimMarkTran.parent; if (AimMarkTran != null) { AiMark markAimScript = AimMarkTran.GetComponent <AiMark>(); pathScript = AiPathCtrlTran.GetComponent <AiPathCtrl>(); SetPlayerAimMarkData(pathScript.PathIndex, markAimScript.getMarkCount(), PlayerTran.name); UpdateAiPlayerAction(); } Invoke("MoveAiPlayerByItween", 0.05f); }