/// <summary> /// 获取是否可以击爆Npc. /// </summary> internal bool GetIsCanJiBaoNpc() { if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有玩家激活游戏时,Ai都是可以击爆JPBoss和战车的. return(true); } if (IsHaveJiBaoNpc == true) { //已经有玩家击爆过npc,其余玩家不能在击爆npc了. return(false); } if (ZeroPlayer == maxPlayer) { //游戏后台配置爆奖率为0时不允许爆奖. return(false); } int minNum = (int)(maxPlayer * (minNumPerArray[indexMinNumPer] / 100f)); if (maxPlayer <= 10) { //最小人数低于10人时强制在一半人数之后允许放奖. minNum = (int)(maxPlayer * 0.5f); } //SSDebug.LogWarning("minNum ======= " + minNum + ", currentNum === " + currentNum + ", maxPlayer == " + maxPlayer); if (minNum >= currentNum) { //积累人数没有达到放奖的最小比例人数时不允许放奖. return(false); } if (currentNum >= maxPlayer) { //当前玩家人数已经积累的足够多了,新来的玩家都可以击爆npc. return(true); } bool isCanJiBao = true; int randNum = (UnityEngine.Random.Range(0, 1000) % 100) + 1; //该玩家在游戏中的爆奖概率 = 累计人头数×该奖池爆奖率.(累计人头数 <= 最大人头数) int baoJiangGaiLv = currentNum * m_BaoJiangLv; //SSDebug.LogWarning("baoJiangGaiLv bossBaoJi == " + baoJiangGaiLv + ", currentNum == " + currentNum // + ", m_BaoJiangLv == " + m_BaoJiangLv + ", randNum == " + randNum); if (randNum > baoJiangGaiLv) { isCanJiBao = false; } return(isCanJiBao); }
void Start() { if (SpawnNpcPoint == null) { Debug.LogError("Unity:" + "SpawnNpcPoint is null"); GameObject obj = null; obj.name = "null"; } XkGameCtrl.GetInstance().ChangeBoxColliderSize(transform); CheckIsHiddenObj(); }
//static int TestPaiJiPaoCount = 0; //int TestPaiJiPaoIndex = 0; void MovePaiJiPaoAmmo() { //TestPaiJiPaoCount++; //TestPaiJiPaoIndex = TestPaiJiPaoCount; IsMovePaiJiPaoAmmoCoreToTop = false; Vector3 firePos = Vector3.zero; Vector3 vecA = AmmoTran.forward; vecA.y = 0f; MinPaiJiPaoDis = MinPaiJiPaoDis < MaxPaiJiPaoDis ? MinPaiJiPaoDis : MaxPaiJiPaoDis; float paoDanMVDis = Random.Range(MinPaiJiPaoDis, MaxPaiJiPaoDis); firePos = vecA * paoDanMVDis + AmmoTran.position; RaycastHit hit; int layerVal = XkGameCtrl.GetInstance() != null?XkGameCtrl.GetInstance().LandLayer.value : 0; Physics.Raycast(firePos, Vector3.down, out hit, 100f, layerVal); if (hit.collider != null) { firePos = hit.point; } if (PaiJiPaoTiShiPrefab != null) { PaiJiPaoTiShi = (GameObject)Instantiate(PaiJiPaoTiShiPrefab, firePos, Quaternion.identity); if (XkGameCtrl.NpcAmmoArray != null) { PaiJiPaoTiShi.transform.parent = XkGameCtrl.NpcAmmoArray; } } float lobHeight = PaiJiPaoGDKey * paoDanMVDis + PaiJiPaoGDMin; float lobTime = PaiJiPaoMvTime; AmmoCore.transform.localEulerAngles = new Vector3(0f, 0f, 0f); iTween.MoveBy(AmmoCore, iTween.Hash("y", lobHeight, "time", lobTime * 0.5f, "easeType", iTween.EaseType.easeOutQuad)); if (IsInvoking("MoveTopPaiJiPaoAmmoCoreOnCompelteITween") == false) { Invoke("MoveTopPaiJiPaoAmmoCoreOnCompelteITween", lobTime * 0.5f); } iTween.MoveBy(AmmoCore, iTween.Hash("y", -lobHeight, "time", lobTime * 0.5f, "delay", lobTime * 0.5f, "easeType", iTween.EaseType.easeInCubic)); iTween.MoveTo(ObjAmmo, iTween.Hash("position", firePos, "time", lobTime, "easeType", iTween.EaseType.linear, "oncomplete", "MovePaiJiPaoAmmoOnCompelteITween")); }
void Start() { if (Network.peerType != NetworkPeerType.Disconnected && _Instance == null && FeiJiMarkCom != null && TanKeMarkCom != null) { _Instance = this; } IsActiveHeTiCloseUI = false; XkGameCtrl.GetInstance().ChangeBoxColliderSize(transform); }
void CheckCameraCom() { if (XkGameCtrl.GetInstance().IsCartoonShootTest) { return; } if (DingDianAimCamera == null || DingDianAimCamera != gameObject) { gameObject.SetActive(false); } }
// NetworkView NetworkViewCom; void Start() { //NetworkViewCom = GetComponent<NetworkView>(); //if (transform.parent != XkGameCtrl.MissionCleanup) { // transform.parent = XkGameCtrl.MissionCleanup; //} m_DaoJuPosOld = transform.position; transform.SetParent(XkGameCtrl.GetInstance().DaoJuArray); DaoJuTr = transform; BoxCol = GetComponent <BoxCollider>(); }
public static AudioListCtrl GetInstance() { if (_Instance == null) { if (XkGameCtrl.GetInstance() != null) { GameObject obj = (GameObject)Instantiate(XkGameCtrl.GetInstance().AudioListPrefab); _Instance = obj.GetComponent <AudioListCtrl>(); } } return(_Instance); }
/// <summary> /// 创建玩家彩票数量UI界面. /// </summary> void CreatCaiPiaoInfoPanel(PlayerEnum indexPlayer, bool isShowCaiPiaoInfo = false) { if (isShowCaiPiaoInfo == true) { //强制显示彩票界面. } else { if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有激活任何玩家. return; } } int index = (int)indexPlayer - 1; if (index < 0 || index > 2) { UnityLogWarning("CreatCaiPiaoInfoPanel -> index was wrong! index ==== " + index); return; } GameObject gmDataPrefab = (GameObject)Resources.Load("Prefabs/GUI/CaiPiaoUI/CaiPiaoInfo"); if (gmDataPrefab != null) { if (m_CaiPiaoInfoArray[index] == null) { if (m_PlayerUIParent[index] != null) { UnityLog("CreatCaiPiaoInfoPanel -> isShowCaiPiaoInfo == " + isShowCaiPiaoInfo); GameObject obj = (GameObject)Instantiate(gmDataPrefab, m_PlayerUIParent[index]); m_CaiPiaoInfoArray[index] = obj.GetComponent <SSGameNumUI>(); SetActiveZhengZaiChuPiaoUI(indexPlayer, true); SSCaiPiaoInfo caiPiaoInfoCom = obj.GetComponent <SSCaiPiaoInfo>(); if (caiPiaoInfoCom != null) { caiPiaoInfoCom.Init(indexPlayer); } } else { UnityLogWarning("CreatCaiPiaoInfoPanel -> m_PlayerUIParent was wrong! index ==== " + index); } } } else { UnityLogWarning("CreatCaiPiaoInfoPanel -> gmDataPrefab was null"); } }
/// <summary> /// 开始查询游戏是否进行了包月. /// </summary> private void OnTimeUpQueryGameBaoYueStateEvent() { //查询游戏包月状态. //QueryGameBaoYueState(); //创建是否选择游戏包月界面. if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_GameUICom != null) { XkGameCtrl.GetInstance().m_GameUICom.CreatGameBaoYuePanel(); } }
// Use this for initialization void Start() { SpawnParticleCom = gameObject.AddComponent <XKSpawnParticle>(); for (int i = 0; i < QianGuanTwRot.Length; i++) { QianGuanTwRot[i].enabled = false; } FireLayer = XkGameCtrl.GetInstance().PlayerAmmoHitLayer; PlayerScript = GetComponent <XkPlayerCtrl>(); PlayerScript.SetPlayerAutoFireScript(this); PlayerStEnum = PlayerScript.PlayerSt; AmmoStatePOne = PlayerAmmoType.PuTongAmmo; AmmoStatePTwo = PlayerAmmoType.PuTongAmmo; if (PlayerStEnum != PlayerTypeEnum.CartoonCamera) { PlayerAudio = PlayerScript.PlayerAudio; for (int i = 0; i < 7; i++) { if (i < 6) { PlayerAudio[i].loop = false; } else { PlayerAudio[i].loop = true; } PlayerAudio[i].Stop(); } InitPlayerAmmoList(); //InputEventCtrl.GetInstance().ClickFireBtOneEvent += ClickFireBtOneEvent; InputEventCtrl.GetInstance().ClickFireBtTwoEvent += ClickFireBtTwoEvent; //InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent += ClickDaoDanBtOneEvent; InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent += ClickDaoDanBtTwoEvent; // if (Network.peerType == NetworkPeerType.Server) { // InitPlayerAmmoList(); // } // // if ((PlayerStEnum == PlayerTypeEnum.FeiJi && XkGameCtrl.GameJiTaiSt == GameJiTaiType.FeiJiJiTai) // || (PlayerStEnum == PlayerTypeEnum.TanKe && XkGameCtrl.GameJiTaiSt == GameJiTaiType.TanKeJiTai)){ // InitPlayerAmmoList(); // InputEventCtrl.GetInstance().ClickFireBtOneEvent += ClickFireBtOneEvent; // InputEventCtrl.GetInstance().ClickFireBtTwoEvent += ClickFireBtTwoEvent; // InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent += ClickDaoDanBtOneEvent; // InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent += ClickDaoDanBtTwoEvent; // } } else { this.enabled = false; } }
/// <summary> /// 获取需要打印的彩票数量. /// </summary> public int GetPrintCaiPiaoValueByDeCaiState(DeCaiState type, SuiJiDaoJuState suiJiDaoJuType = SuiJiDaoJuState.BaoXiang) { int value = 0; int coinStart = XKGlobalData.GetInstance().m_CoinToCard *XKGlobalData.GameNeedCoin; switch (type) { case DeCaiState.ZhanChe: { if (XkGameCtrl.GetInstance().m_CaiPiaoMode == XkGameCtrl.CaiPiaoModeSuanFa.GuDing) { value = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GuDingBanCaiPiaoData.ZhanCheDeCai; } else { value = (int)(coinStart * ZhanCheChuPiaoTiaoJian); } break; } case DeCaiState.SuiJiDaoJu: { float suiJiDaoJuChuPiaoLv = 0f; SuiJiDaoJuData suiJiDaoJuData = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_SuiJiDaoJuData; if (suiJiDaoJuType == SuiJiDaoJuState.TouZi) { suiJiDaoJuChuPiaoLv = suiJiDaoJuData.TouZiDePiaoLv; } else { suiJiDaoJuChuPiaoLv = suiJiDaoJuData.BaoXiangDePiaoLv; } value = (int)(coinStart * SuiJiDaoJuChuPiaoTiaoJian); //应该给玩家的彩票数量. value = (int)(value * suiJiDaoJuChuPiaoLv); break; } case DeCaiState.JPBoss: { if (XkGameCtrl.GetInstance().m_CaiPiaoMode == XkGameCtrl.CaiPiaoModeSuanFa.GuDing) { value = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GuDingBanCaiPiaoData.GetJPBossChuPiaoTiaoJian(); } else { value = (int)(coinStart * JPBossChuPiaoTiaoJian); } break; } } return(value); }
public void ShowTiaoGuoBt() { if (XkGameCtrl.GetInstance().IsCartoonShootTest) { return; } if (TiaoGuoBtObj.activeSelf) { return; } TiaoGuoBtObj.SetActive(true); }
internal void RemoveSelf() { if (IsRemoveSelf == false) { IsRemoveSelf = true; if (XkGameCtrl.GetInstance() != null) { //评级结束之后重置玩家分数信息. XkGameCtrl.GetInstance().ResetPlayerInfo(m_IndexPlayer); } Destroy(gameObject); } }
/// <summary> /// 微信玩家关闭倒计时界面,当玩家续费失败后. /// </summary> internal void WXPlayerStopGameDaoJiShi() { if (IsPlayDaoJishi == false) { return; } StopDaoJiShi(); ShowGameOverObj(); //玩家没有进行续币. //重置玩家续币信息. XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.ResetPlayerXuBiInfo(PlayerIndex); XkGameCtrl.GetInstance().ResetPlayerInfo(PlayerIndex); }
public static void ResetIsClosePlayerUI(int key = 0) { if (key == 0) { IsClosePlayerUI = false; } if (XkGameCtrl.GetInstance().IsCartoonShootTest || Network.peerType == NetworkPeerType.Server) { return; } ScreenDanHeiCtrl.GetInstance().OpenPlayerUI(); }
/// <summary> /// 显示爆炸粒子的彩票UI数量信息. /// </summary> internal void ShowNumUI(SSCaiPiaoDataManage.GameCaiPiaoData.DeCaiState deCaiType, XKNpcHealthCtrl healthCom) { if (m_CaiPiaoInfoParent != null) { m_CaiPiaoInfoParent.gameObject.SetActive(true); } enabled = true; m_NpcHealthCom = healthCom; int num = XkPlayerCtrl.GetInstanceFeiJi().m_SpawnNpcManage.m_CaiPiaoDataManage.m_GameCaiPiaoData.GetPrintCaiPiaoValueByDeCaiState(deCaiType); string numStr = num.ToString(); if (m_FixedUiPosDt != null && m_FixedUiPosDt.IsFixPosX) { if (m_FixedUiPosDt.UIParent != null) { int len = numStr.Length; if (m_FixedUiPosDt.m_PosXArray.Length >= len) { //动态修改UI数据的父级坐标. Vector3 posTmp = m_FixedUiPosDt.UIParent.localPosition; posTmp.x = m_FixedUiPosDt.m_PosXArray[len - 1]; m_FixedUiPosDt.UIParent.localPosition = posTmp; } } } int max = m_NumRenderArray.Length; int numVal = num; int valTmp = 0; int powVal = 0; for (int i = 0; i < max; i++) { if (max - i > numStr.Length && IsHiddenGaoWeiNumZero) { //隐藏数据高位的0. m_NumRenderArray[i].material = XkGameCtrl.GetInstance().m_CaiPiaoLiZiNumATouMing; } else { //m_UISpriteArray[i].enabled = true; powVal = (int)Mathf.Pow(10, max - i - 1); valTmp = numVal / powVal; //UnityLog("ShowNumUI -> valTmp ====== " + valTmp); m_NumRenderArray[i].material = XkGameCtrl.GetInstance().m_NpcCaiPiaoNumArray[valTmp]; //m_UISpriteArray[i].spriteName = valTmp.ToString(); numVal -= valTmp * powVal; } } }
/// <summary> /// 循环产生空袭导弹. /// </summary> IEnumerator LoopSpawnKongXiDaoDan(GameObject playerDaoDan) { bool isDamagePlayer = false; do { if (KongXiDt.IsRemoveKongXiZuDang) { Debug.Log("LoopSpawnKongXiDaoDan -> stop!"); yield break; } Debug.Log("LoopSpawnKongXiDaoDan -> time " + Time.time); int max = KongXiDt.AmmoPointTr.Length; for (int i = 0; i < max; i++) { if (mPlayerScript != null && KongXiDt.AmmoPointTr[i] != null) { KongXiDt.AmmoPointTr[i].gameObject.SetActive(false); mPlayerScript.SpawnPlayerDaoDan(KongXiDt.AmmoPointTr[i], playerDaoDan); } } if (!isDamagePlayer) { Vector3 pos1 = KongXiDt.KongXiDianObj.transform.position; Vector3 pos2 = XkPlayerCtrl.GetInstanceTanKe().transform.position; pos1.y = pos2.y = 0f; if (Vector3.Distance(pos1, pos2) <= KongXiDt.DamageDis) { isDamagePlayer = true; XkGameCtrl.GetInstance().SubPlayerYouLiang(PlayerEnum.PlayerOne, KongXiDt.PlayerDamage); XkGameCtrl.GetInstance().SubPlayerYouLiang(PlayerEnum.PlayerTwo, KongXiDt.PlayerDamage); if (GameUICenterCtrl.GetInstance() != null) { GameUICenterCtrl.GetInstance().RemoveKongXiZuDangUI(); GameUICenterCtrl.GetInstance().RemoveKongXiShanHongUI(); GameUICenterCtrl.GetInstance().RemoveKongXiDaoJishiUI(); GameUICenterCtrl.GetInstance().SpawnKongXiJiZhongUI(); } if (mPlayerScript.GetPlayerCameraScript() != null) { //画面开始变黑白. mPlayerScript.GetPlayerCameraScript().mCameraColorChange.Init(); } } } yield return(new WaitForSeconds(KongXiDt.TimeLoopDaoDan)); }while (!KongXiDt.IsRemoveKongXiZuDang); }
/// <summary> /// 更新玩家再玩一局游戏奖品的概率信息. /// </summary> internal void UpdataXueBaoJianGeTime(int xueBaoJianGeTime) { if (xueBaoJianGeTime <= 0) { xueBaoJianGeTime = 10; } m_XueBaoJianGeTime = xueBaoJianGeTime; WriteToFileXml(m_FileName, "XueBaoJianGeTime", xueBaoJianGeTime.ToString()); if (XkGameCtrl.GetInstance() != null) { XkGameCtrl.GetInstance().m_NpcDiaoDaoJuTimeLengQue = xueBaoJianGeTime; } }
public void ClickPcvrBt02(pcvr.ButtonState val) { if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer) { //没有玩家激活游戏. } else { if (ClickPcvrBtEvent02 != null) { ClickPcvrBtEvent02(val); } } }
// Use this for initialization void Awake() { if (pcvr.TKMoveSt == TKMoveState.U_FangXiangPan) { TimeDanGuanFire *= XkGameCtrl.GetInstance().NpcAmmoTime; TimeAmmoWait *= XkGameCtrl.GetInstance().NpcAmmoTime; } if (AudioCannonFire != null) { AudioCannonFire.playOnAwake = false; AudioCannonFire.Stop(); } }
void Awake() { CameraVRTr = XkGameCtrl.GetInstance().CameraVRObj[0].transform; if (PlayerGunCameraObj != null && PlayerGunCameraObj.Length >= 2) { for (int i = 0; i < 2; i++) { if (PlayerGunCameraObj[i] != null) { PlayerGunCameraObj[i].SetActive(XkGameCtrl.GetInstance().IsOpenVR); } } } }
/// <summary> /// 更新玩家再玩一局游戏奖品的概率信息. /// </summary> internal void UpdataZaiWanYiJuGaiLv(int zaiWanYiJuGaiLv) { if (zaiWanYiJuGaiLv < 0) { zaiWanYiJuGaiLv = 10; } m_ZaiWanYiJuGaiLv = zaiWanYiJuGaiLv; WriteToFileXml(m_FileName, "ZaiWanYiJuGaiLv", zaiWanYiJuGaiLv.ToString()); if (XkGameCtrl.GetInstance() != null) { XkGameCtrl.GetInstance().UpdateZaiWanYiJuGaiLv(zaiWanYiJuGaiLv); } }
void OnTriggerEnter(Collider other) { if (IsDonnotSpawnNpcTest) { return; //test. } if (JiFenJieMianCtrl.GetInstance().GetIsShowFinishTask()) { return; } if (Network.peerType == NetworkPeerType.Client) { return; } XkPlayerCtrl ScriptPlayer = other.GetComponent <XkPlayerCtrl>(); if (ScriptPlayer == null) { return; } if (Time.time - m_LastTriggerTime < 300f) { //冷却时间. return; } m_LastTriggerTime = Time.time; if (XkGameCtrl.GetInstance().IsDisplayBossDeathYanHua == true) { return; } //Debug.Log("Unity:"+"XKTriggerSpawnNpc::OnTriggerEnter -> hit "+other.name); for (int i = 0; i < SpawnPointArray.Length; i++) { // if (SpawnPointArray[i].NpcObj.name != TestNpcName || SpawnPointArray[i].NpcFangZhen != null) { // continue; //test // } // // if (IsDonnotSpawnNpcTest) { // return; // } // IsDonnotSpawnNpcTest = true; SpawnPointArray[i].SpawnPointAllNpc(); } }
public void ShowPlayerFenShuBeiLv(PlayerEnum indexVal) { XKFenShuBeiLvMove fenShuBeiLvMoveCom = GetXKFenShuBeiLvMove(); if (fenShuBeiLvMoveCom == null) { return; } Transform playerTr = XKPlayerMoveCtrl.GetInstance(indexVal).PiaoFenPoint; Vector3 startPos = XkGameCtrl.GetInstance().GetWorldObjToScreenPos(playerTr.position); fenShuBeiLvMoveCom.SetPlayerFenShuBeiLvVal(startPos); }
/// <summary> /// 使对象坐标贴地. /// </summary> void MakePintToLand(Transform tr) { if (tr != null) { RaycastHit hitInfo; Vector3 startPos = tr.position + Vector3.up * 20f; Vector3 forwardVal = Vector3.down; Physics.Raycast(startPos, forwardVal, out hitInfo, 200f, XkGameCtrl.GetInstance().LandLayer); if (hitInfo.collider != null) { tr.position = hitInfo.point + Vector3.up * 5f; } } }
/// <summary> /// 延迟关闭道具向上运动的状态. /// </summary> IEnumerator DelayCloseMoveDaoJuToHeightPosByITween() { float time = 1f; if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_XueBaoDaoJuData != null) { //血包道具在空中停留的时间. time = XkGameCtrl.GetInstance().m_XueBaoDaoJuData.m_XueBaoTingLiuTime; } yield return(new WaitForSeconds(time)); IsMoveOverDaoJuByItween = true; SetBuJiBaoRigbody(false); }
public void ShowPlayerJiJiuBao(PlayerEnum indexVal) { XKPlayerJiJiuBaoMove huoLiOpenMoveCom = GetXKPlayerJiJiuBaoMove(); if (huoLiOpenMoveCom == null) { return; } Transform playerTr = XKPlayerMoveCtrl.GetXKPlayerMoveCtrl(indexVal).PiaoFenPoint; Vector3 startPos = XkGameCtrl.GetInstance().GetWorldObjToScreenPos(playerTr.position); huoLiOpenMoveCom.SetPlayerJiJiuBaoVal(startPos); }
IEnumerator DelayLoadingReconectServerGameScene() { IsLoadingReconnectServerScene = true; if (SSUIRoot.GetInstance().m_GameUIManage != null) { SSUIRoot.GetInstance().m_GameUIManage.CreateCompanyLogo(); } //if (pcvr.GetInstance().m_HongDDGamePadInterface != null) //{ // //关闭WebSocket // pcvr.GetInstance().m_HongDDGamePadInterface.CloseWebSocket(); //} UITexture uiTexture = gameObject.GetComponent <UITexture>(); if (uiTexture != null) { uiTexture.enabled = false; } float audioVol = 1f; do { yield return(new WaitForSeconds(0.1f)); audioVol -= 0.05f; if (audioVol < 0f) { audioVol = 0f; } AudioListener.volume = audioVol; if (audioVol <= 0f) { break; } } while (true); yield return(new WaitForSeconds(0.2f)); if (pcvr.GetInstance().m_HongDDGamePadInterface != null) { //重启websocket. pcvr.GetInstance().m_HongDDGamePadInterface.OnXiTiaoMsgTimeOutFromWangLuoGuZhang(); } XkGameCtrl.IsLoadingLevel = false; XkGameCtrl.GetInstance().LoadingReconnectServerGameScene(); }
void MoveAmmoByItween() { float disVal = 500f; RaycastHit hitInfo; Vector3[] posArray = new Vector3[2]; Vector3 startPos = AmmoTran.position; Vector3 forwardVal = AmmoTran.forward; //Instantiate(testObjAmmo, AmmoTran.position, AmmoTran.rotation); //test Vector3 firePos = startPos + (forwardVal * disVal); startPos += forwardVal * 3f; //优化处理,当npo子弹速度足够大时采用. if (MvSpeed > SpeedMaxVal) { Physics.Raycast(startPos, forwardVal, out hitInfo, disVal, NpcAmmoHitLayer); if (hitInfo.collider != null) { firePos = hitInfo.point; //Debug.Log("Unity:"+"*****npcAmmoHitObj "+hitInfo.collider.name); XKPlayerMoveCtrl playerScript = hitInfo.collider.GetComponent <XKPlayerMoveCtrl>(); if (playerScript != null && !playerScript.GetIsWuDiState()) { if (AmmoType == PlayerAmmoType.GenZongAmmo && IsOnlyHitTarget == true && TargetObject != null && TargetObject != playerScript.GenZongDanAimPoint) { //只对跟踪目标造成伤害的跟踪弹. } else { XkGameCtrl.GetInstance().SubGamePlayerHealth(playerScript.PlayerIndex, PlayerDamage); } } } } // TimeScaleVal = Time.timeScale; posArray[0] = AmmoTran.position; posArray[1] = firePos; #if !USE_SPHERE_HIT AmmoStartPos = posArray[0]; AmmoEndPos = firePos; #endif iTween.MoveTo(ObjAmmo, iTween.Hash("path", posArray, "speed", MvSpeed, "orienttopath", true, "easeType", iTween.EaseType.linear, "oncomplete", "MoveAmmoOnCompelteITween")); }
/// <summary> /// 结束移动. /// </summary> void CloseMove() { if (IsMoveNpc == false) { return; } IsMoveNpc = false; //镜头继续移动. XkGameCtrl.GetInstance().SetGameCameraIsMoveing(true, NpcJiFenEnum.Boss); if (m_NpcMoveCom != null) { m_NpcMoveCom.RestartMoveingBoss(); } }