//NPC死亡特效 private void NPCDeadEffect(int _multi, int _power) { // 死亡效果. switch (fishType) { // 全屏炸弹就初始化移动到屏幕中心的参数. case FishType.quanping: { specialFishMovePercent = 0f; move2CenterStartPos = cur_Transform.position; move2CenterStartEuler = cur_Transform.localEulerAngles; move2CenterSpeed = 1f / move2CenterTimeLength; specialFishDeadState = SpecialFishDeadState.drag2Center; break; } // 黑洞就初始化移动到屏幕中心的参数. case FishType.blackHall: { // 黑洞需要吸的倍率. bh_need2AbsorbMulti = _multi; // 黑洞需要吸的分值. bh_need2AbsorbValue = _multi * _power; specialFishMovePercent = 0f; move2CenterStartPos = cur_Transform.position; move2CenterStartEuler = cur_Transform.localEulerAngles; move2CenterSpeed = 1f / move2CenterTimeLength; specialFishDeadState = SpecialFishDeadState.drag2Center; break; } // 普通鱼就只要在这里播放死亡特效就可以了. default: if (deadEffList.Count > 0) { FishDeadEffHandler.CreatedFishDeadEffCtrlItem(this, deadEffList); } break; } }
// 黑洞死亡 private void blackHallDead() { switch (specialFishDeadState) { // 移动到中间. case SpecialFishDeadState.drag2Center: { specialFishMovePercent += Time.deltaTime * move2CenterSpeed; cur_Transform.position = Vector3.Lerp(move2CenterStartPos, Vector3.zero, specialFishMovePercent); cur_Transform.localEulerAngles = Vector3.Lerp(move2CenterStartEuler, Vector3.zero, specialFishMovePercent); if (specialFishMovePercent > 1f) { specialFishMovePercent = 0f; specialFishDeadState = SpecialFishDeadState.wait; } // 连接玩家到黑洞的线. if (blackHallLineRend != null) { // Vector3 _pos0_InLockCam = LockCtrl.Instance.uiCamPos_to_LockCamPos(cur_Transform.position); Vector3 _pos0_InLockCam = cur_Transform.position; blackHallLineRend.SetPosition(0, _pos0_InLockCam); } break; } // 吸鱼等待状态. case SpecialFishDeadState.wait: break; // 回收. case SpecialFishDeadState.recycle: { // 播放死亡效果. if (deadEffList.Count > 0) { FishDeadEffHandler.CreatedFishDeadEffCtrlItem(this, deadEffList); } // 鱼身上的数字. // NumCtrl.Instance.CreateFishDeadNum(_value, m_traCache.position, Quaternion.identity); // 金币. CoinCtrl.Instance.CreateCoins(canonID, coinType, coinNum, cur_Transform.position, playCoinAudio); // 如果不是当鱼死亡后就播放 high score, 就在这里播放. if (!showHighScoreWhenFishDead) { if (highScorePrefab != null && fishDeadValue > 0) { HighScoreCtrl.Instance.Create(canonID, highScorePrefab, CanonCtrl.Instance.singleCanonList[canonID].highScorePos, fishDeadValue, CanonCtrl.Instance.singleCanonList[canonID].dir); } } // 喇叭. // TrumpetCtrl.Instance.CreateOneTrumpet(canonID, serverMulti, fishDeadValue); // 金币柱. if (TotalCylinderCtrl.Instance.showCylider) { TotalCylinderCtrl.Instance.singleCylinderList[canonID].Add2Need2CreateList(multi, fishDeadValue, CanonCtrl.Instance.singleCanonList[canonID].cylinderShowUpPos.position); } // 恢复玩家发炮状态. if (canNotPlayUntilRecycle) { CanonCtrl.Instance.AllowFire(true); } // 回收黑洞的数字. if (blackHallNumCreated != null) { Factory.Recycle(blackHallNumCreated); } // 回收黑洞的线. if (blackHallLineCreated != null) { Factory.Recycle(blackHallLineCreated); } // 回收黑洞. RecycleFish(); break; } } // 黑洞的数字跟随着黑洞移动. if (blackHallNumCreated != null && blackHallNumCreated.gameObject.activeSelf) { blackHallNumCreated.localPosition = cur_Transform.localPosition + new Vector3(0f, blackHallHeight, 0f); } }
//全屏死亡 private void quanpingDead() { switch (specialFishDeadState) { // 移动这条鱼到屏幕中心. case SpecialFishDeadState.drag2Center: { specialFishMovePercent += Time.deltaTime * move2CenterSpeed; cur_Transform.position = Vector3.Lerp(move2CenterStartPos, Vector3.zero, specialFishMovePercent); if (specialFishMovePercent > 1f) { // 如果有死亡特效,就做特效. if (deadEffList.Count > 0) { FishDeadEffHandler.CreatedFishDeadEffCtrlItem(this, deadEffList); } // 还剩多长时间就回收鱼 = 鱼死亡时间 - 移动到屏幕的时间. float _leftTimeLength = deadTimeLength - move2CenterTimeLength; if (_leftTimeLength < 0f) { _leftTimeLength = 0f; } // 移动的速度. move2CenterSpeed = 1f / _leftTimeLength; specialFishMovePercent = 0f; specialFishDeadState = SpecialFishDeadState.wait; } break; } case SpecialFishDeadState.wait: { specialFishMovePercent += Time.deltaTime * move2CenterSpeed; if (specialFishMovePercent > 1f) { if (!specialFishHaveAddValue) { // 把分数加给玩家. CanonCtrl.Instance.singleCanonList[canonID].AddValueList(fishDeadValue, 0f); specialFishHaveAddValue = true; } // 处理全屏鱼杀死其他鱼的逻辑. SpecialFishDeadHandler.QuanPing_Kill_Fish(this, canonID, bulletCost); // 鱼身上的分数. // NumCtrl.Instance.CreateFishDeadNum(_value, m_traCache.position, Quaternion.identity); // 鱼的 bubble 分数. NumCtrl.Instance.AdddBubble2List(serverMulti, fishDeadValue, CanonCtrl.Instance.singleCanonList[canonID].bubbleShowUpPos.position, Quaternion.identity, CanonCtrl.Instance.singleCanonList[canonID].upsideDown); // 鱼的金币. CoinCtrl.Instance.CreateCoins(canonID, coinType, coinNum, cur_Transform.position, playCoinAudio); // 如果不是当鱼死亡后就播放 high score, 就在这里播放. if (!showHighScoreWhenFishDead) { // 有high score 预设,并且分数不为0. if (highScorePrefab != null && fishDeadValue > 0) { HighScoreCtrl.Instance.Create(canonID, highScorePrefab, CanonCtrl.Instance.singleCanonList[canonID].highScorePos, fishDeadValue, CanonCtrl.Instance.singleCanonList[canonID].dir); } } // 创建 喇叭. // TrumpetCtrl.Instance.CreateOneTrumpet(canonID, serverMulti, fishDeadValue); // 创建金币柱. if (TotalCylinderCtrl.Instance.showCylider) { TotalCylinderCtrl.Instance.singleCylinderList[canonID].Add2Need2CreateList(serverMulti, fishDeadValue, CanonCtrl.Instance.singleCanonList[canonID].cylinderShowUpPos.position); } // 恢复玩家发炮状态. if (canNotPlayUntilRecycle) { CanonCtrl.Instance.AllowFire(true); } // 回收鱼. RecycleFish(); } break; } } }