This commit is contained in:
2026-06-03 18:27:45 +08:00
parent 90e2e0e62f
commit cdeedd72d4
17 changed files with 566 additions and 314 deletions
+46 -22
View File
@@ -507,6 +507,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4821737002055278}
- component: {fileID: 7282750577698165038}
m_Layer: 14
m_Name: 1594
m_TagString: Untagged
@@ -531,6 +532,51 @@ Transform:
- {fileID: 4325409775105146}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
--- !u!61 &7282750577698165038
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1138873142606774}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -0.15831041, y: 0.1963048}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 3.013708, y: 3.4696417}
m_EdgeRadius: 0
--- !u!1 &1141507305235364
GameObject:
m_ObjectHideFlags: 0
@@ -4038,7 +4084,6 @@ GameObject:
m_Component:
- component: {fileID: 4348936247954192}
- component: {fileID: 95596720524527744}
- component: {fileID: 65452356976373814}
m_Layer: 14
m_Name: 1594
m_TagString: Untagged
@@ -4092,27 +4137,6 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!65 &65452356976373814
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1435810989275307}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 0
serializedVersion: 3
m_Size: {x: 1.2370911, y: 1.6150055, z: 1.2063947}
m_Center: {x: -0.008102417, y: 1.0653458, z: 0.09059942}
--- !u!1 &1435874370419781
GameObject:
m_ObjectHideFlags: 0
+1 -1
View File
@@ -84505,7 +84505,7 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -100}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 1, y: 1, z: -1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4156980897181403}
@@ -11,10 +11,16 @@ Material:
m_Shader: {fileID: 4800000, guid: b4718caa1a00b5f448f74c5f56545772, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_ValidKeywords:
- _CUSTOMLIGHT_ADD
- _RIM_ON
m_InvalidKeywords:
- _CUSTOMLIGHT_ON_ON
- _EMISSION_TEXTURE
- _FIXSUBSTANCEPAINTER_ON
- _HAIRMASK_ON
- _Hit_RIM
- _USEINDIRSPECULAR_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
@@ -12,12 +12,20 @@ Material:
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _CUSTOMLIGHT_ADD
- _CUSTOMLIGHT_ON
- _MATCAP_ON
m_InvalidKeywords:
- _ACES_ENABLE_ON
- _COLORADJUST
- _CUSTOMLIGHT
- _CUSTOMLIGHT_ON_ON
- _EMISSION_TEXTURE
- _EMISS_ON
- _FIXSUBSTANCEPAINTER_ON
- _Hit_RIM
- _RIMMULTISELFCOLOR_ON
- _USEINDIRSPECULAR_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
@@ -116,6 +116,9 @@ public class MonsterContral : MonoBehaviour
public List<Transform> colliderList;
/// <summary>是否存活(活跃且未被回收)</summary>
public bool IsAlive => gameObject.activeInHierarchy;
// ================================================================
@@ -1,4 +1,4 @@
using Assets.MyGame.Scripts.Net.APIResponses.Enum;
using Assets.MyGame.Scripts.Net.APIResponses.Enum;
using Assets.MyGame.Scripts.Net.WebResponses;
using DG.Tweening;
using System;
@@ -13,271 +13,215 @@ using Random = UnityEngine.Random;
public class MonsterControl_BossBase : MonsterContral
{
// ==================== 基础 ====================
public string bossName;
// ==================== 爆奖 ====================
[Header("爆奖")]
public bool isToUI = true; // 爆奖特效是 UI(RectTransform)还是 3D 场景物体
public LayeredPool layeredPool;
public TextMeshProUGUI tMP_CurrBossScore;//boss分数
public long currBossScoreValue=0;//boss分数
public long bossScoreValue=0;//boss分数
public int poolNum;//奖池
public int prizeCount;//奖励数量
public Action<int> JiaFen;
public TextMeshProUGUI tMP_CurrBossScore; // Boss 分数显示文本
public long currBossScoreValue; // 当前滚动分数
public long bossScoreValue; // 累计总分
public int poolNum; // 奖池金币
public int prizeCount = 8; // 爆奖红包数量
public Action<int> JiaFen; // 加分回调
public List<List<RedPacketRecord>> redPacketRecords = new List<List<RedPacketRecord>>();
public bool isToUI = true;
public Camera ZhuCam;
// ==================== 死亡 ====================
public bool isDieFish;
public float dieTime = 3f;
public Vector3 v3; // 分数飞出目标位置(Inspector 设置)
private long _turretNum;
private bool _isJia;
// ==================== Unity 生命周期 ====================
public override void Awake()
{
base.Awake();
isRotate = false;
ZhuCam = GameManager.Instance.ZhuCam;
action_effect_DieAward = (obj) =>
action_effect_DieAward = obj =>
{
tMP_CurrBossScore = obj
.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
tMP_CurrBossScore = obj.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
};
}
public override void OnEnable()
{
base.OnEnable();
layeredPool = null;
FishResourcesData fishResourcesData;
currBossScoreValue = 0;
bossScoreValue = 0;
redPacketRecords.Clear();
_isJia = false;
isDieFish = false;
fishResourcesData = FishResourcesData.fishResourcesDatasDic[fishTypeID];
if (fishResourcesData.showAudio != null && fishResourcesData.showAudio.Count > 0)
{
var v = fishResourcesData.showAudio;
int index = Random.Range(0, v.Count);
AudioManager.Instance.PlayerFX(v[index]);
}
var res = FishResourcesData.fishResourcesDatasDic[fishTypeID];
if (res.showAudio != null && res.showAudio.Count > 0)
AudioManager.Instance.PlayerFX(res.showAudio[Random.Range(0, res.showAudio.Count)]);
}
public void BigPrizeNotFish(int num)
{
if (layeredPool == null)
{
layeredPool = new LayeredPool(poolNum, prizeCount); // 初始化LayeredPool,假设5个人,10000分
}
if (tMP_CurrBossScore == null)
{
tMP_CurrBossScore = Instantiate(CreateFishManager.Instance.dieFXPrefabAwardTmp, CreateFishManager.Instance.currGameType.subPanelParent).transform.GetChild(0).GetComponent<TextMeshProUGUI>();
}
var v = layeredPool.BossGlodCoinNotFish(num);
redPacketRecords.Add(v);
foreach (var item in v)
{
bossScoreValue += item.Amount;
}
turretNum = CreateFishManager.Instance.currGameType.currSitData.consumeGoldNum;
GameManager.Instance.StartCoroutine(ShowBigPrize());
GameManager.Instance.StartCoroutine(jiafen());
}
public void BigPrize(int min = 4, int max = 8)
{
if (layeredPool==null)
{
layeredPool = new LayeredPool(poolNum, prizeCount); // 初始化LayeredPool,假设5个人,10000分
}
if (tMP_CurrBossScore == null)
{
tMP_CurrBossScore = Instantiate(CreateFishManager.Instance.dieFXPrefabAwardTmp, CreateFishManager.Instance.currGameType.subPanelParent).transform.GetChild(0).GetComponent<TextMeshProUGUI>();
}
var v = layeredPool.BossGlodCoinRandrom(tMP_CurrBossScore.transform.position,min,max);
redPacketRecords.Add(v);
foreach (var item in v)
{
bossScoreValue += item.Amount;
}
turretNum = CreateFishManager.Instance.currGameType.currSitData.consumeGoldNum;
GameManager.Instance. StartCoroutine(ShowBigPrize());
GameManager.Instance.StartCoroutine(jiafen());
}
bool isJia = false;
public void BigPrizeAll()
{
int sss = CreateFishManager.Instance.fishDatas_hashCodekey_Small.Count;
prizeCount = 1;
if (layeredPool == null)
{
layeredPool = new LayeredPool(poolNum, prizeCount); // 初始化LayeredPool,假设5个人,10000分
}
if (tMP_CurrBossScore == null)
{
tMP_CurrBossScore = Instantiate(CreateFishManager.Instance.dieFXPrefabAwardTmp, CreateFishManager.Instance.currGameType.subPanelParent).transform.GetChild(0).GetComponent<TextMeshProUGUI>();
}
var v = layeredPool.BossGlodCoin(sss, tMP_CurrBossScore.transform.position);
redPacketRecords.Add(v);
foreach (var item in v)
{
bossScoreValue += item.Amount;
}
turretNum = CreateFishManager.Instance.currGameType.currSitData.consumeGoldNum;
GameManager.Instance.StartCoroutine(ShowBigPrize());
GameManager.Instance.StartCoroutine(jiafen());
}
long turretNum;
IEnumerator ShowBigPrize()
{
if (!isJia)
{
isJia=true;
yield return new WaitForSeconds(1);
turretNum = Random.Range((int)(turretNum / 2), (int)turretNum + 1);
while (currBossScoreValue < bossScoreValue)
{
currBossScoreValue += 1 * turretNum; // 每次增加1000分
if (currBossScoreValue > bossScoreValue)
{
currBossScoreValue = bossScoreValue; // 确保不超过总分数
}
tMP_CurrBossScore.text = currBossScoreValue.ToString(); // 更新UI显示
//yield return new WaitForSeconds(0.05f); // 每0.1秒更新一次
yield return null;
}
isJia = false;
}
}
public IEnumerator jiafen()
{
yield return new WaitForSeconds(1.5f);
Transform tra = tMP_CurrBossScore.transform.parent;
GameObject obj = CreateFishManager.Instance.dieFXPrefabAwardTmp_AddScore;
List<RedPacketRecord> redRecords = new List<RedPacketRecord>();
redRecords = redPacketRecords[0];
redPacketRecords.RemoveAt(0);
foreach (var item in redRecords)
{
yield return new WaitForSeconds(0.15f);
Instantiate(obj, tra.position, Quaternion.identity, tra).transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = CoinScript.NumAdd(item.Amount.ToString());
AudioManager.Instance.PlayerFX(61009);
}
}
public bool isDieFish=false;
public override void DieFish(RoomKillNotice obj = null)
{
isDieFish = true;
//CreateFishManager.Instance.Id_DieFish_NotFX(guid);
GameManager.Instance.cameraShake.ShakePresets.Explosion2D(3f, 4f, 1f);
if (obj != null)
{
poolNum = obj.gold;
}
FishResourcesData fishResourcesData;
fishResourcesData = FishResourcesData.fishResourcesDatasDic[fishTypeID];
if (fishResourcesData.dieAudio!=null&& fishResourcesData.dieAudio.Count>0)
{
var v = fishResourcesData.dieAudio;
int index = Random.Range(0, v.Count);
AudioManager.Instance.PlayerFX(v[index]);
}
}
public void EndBigPrize()
{
}
public async override void Init(string pathId, float Time, bool isyuzhen = false, string yzID = "")
{
isyz = isyuzhen;
this.yzID = yzID;
//播报
switch (GameManager.Instance.gameData.currGameType)
{
case GameType.JQQD:
break;
case GameType.defaultPanel:
break;
case GameType.FLZY:
//{
// AsyncOperationHandle<Sprite> handle = Addressables.LoadAssetAsync<Sprite>("Assets/Art/XJMH/pw/pw_sprite/handbook/" + bossName + ".png");
// await handle.Task;
// Sprite sprite = handle.Result;
// CreateFishManager.Instance. currGameType.subUIManager.ShowBoardBoss(sprite, bossName);
//}
break;
case GameType.YYSC:
//还没有写呢
//{
// AsyncOperationHandle<Sprite> handle = Addressables.LoadAssetAsync<Sprite>("Assets/Art/XJMH/pw/pw_sprite/handbook/" + bossName + ".png");
// await handle.Task;
// Sprite sprite = handle.Result;
// CreateFishManager.Instance.currGameType.subUIManager.ShowBoardBoss(sprite, bossName);
//}
break;
case GameType.ZGXQ:
break;
case GameType.XJMH:
{
AsyncOperationHandle<Sprite> handle = Addressables.LoadAssetAsync<Sprite>("Assets/Art/XJMH/pw/pw_sprite/handbook/" + bossName + ".png");
await handle.Task;
Sprite sprite = handle.Result;
CreateFishManager.Instance.currGameType.subUIManager.ShowBoardBoss(sprite, bossName);
}
break;
case GameType.HHWK:
//{
// AsyncOperationHandle<Sprite> handle = Addressables.LoadAssetAsync<Sprite>("Assets/Art/XJMH/pw/pw_sprite/handbook/" + bossName + ".png");
// await handle.Task;
// Sprite sprite = handle.Result;
// CreateFishManager.Instance.currGameType.subUIManager.ShowBoardBoss(sprite, bossName);
//}
break;
default:
break;
}
BezierCurveData bezierCurveData = MonsterMoveLine.dic_BezierCurveDatas[bossName + pathId];
monsterData.moveLine.Init(bezierCurveData, Time);
}
public override void OnDisable()
{
base.OnDisable();
if (isDieFish)
{
GameManager.Instance.StartCoroutine(yanchidie());
}
GameManager.Instance.StartCoroutine(YanChiDie());
}
public float dieTime = 3f;
public Vector3 v3;//分数飞出位置
IEnumerator yanchidie()
// ==================== 初始化 ====================
public async override void Init(string pathId, float time, bool isyuzhen = false, string yzID = "")
{
isyz = isyuzhen;
this.yzID = yzID;
// Boss 进场播报
if (GameManager.Instance.gameData.currGameType == GameType.XJMH)
{
var handle = Addressables.LoadAssetAsync<Sprite>($"Assets/Art/XJMH/pw/pw_sprite/handbook/{bossName}.png");
await handle.Task;
CreateFishManager.Instance.currGameType.subUIManager.ShowBoardBoss(handle.Result, bossName);
}
var bezierData = MonsterMoveLine.dic_BezierCurveDatas[bossName + pathId];
monsterData.moveLine.Init(bezierData, time);
}
// ==================== 爆奖(公共) ====================
/// <summary>确保分数显示文本存在(自动创建)</summary>
private void EnsureScorePanel()
{
if (tMP_CurrBossScore != null) return;
var prefab = CreateFishManager.Instance.dieFXPrefabAwardTmp;
if (prefab == null) return;
var parent = CreateFishManager.Instance.currGameType.subPanelParent;
if (parent == null) return;
tMP_CurrBossScore = Instantiate(prefab, parent)
.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
}
/// <summary>初始化红包分层对象池</summary>
private void EnsureLayeredPool()
{
if (layeredPool == null)
layeredPool = new LayeredPool(poolNum, prizeCount);
}
/// <summary>爆奖:随机红包(min~max 个)</summary>
public void BigPrize(int min = 4, int max = 8)
{
EnsureScorePanel();
EnsureLayeredPool();
var records = layeredPool.BossGlodCoinRandrom(tMP_CurrBossScore.transform.position, min, max);
AddRedPacket(records);
}
/// <summary>爆奖:固定数量红包</summary>
public void BigPrizeNotFish(int count)
{
EnsureScorePanel();
EnsureLayeredPool();
var records = layeredPool.BossGlodCoinNotFish(count);
AddRedPacket(records);
}
/// <summary>爆奖:全屏小鱼数量红包</summary>
public void BigPrizeAll()
{
int smallFishCount = CreateFishManager.Instance.fishDatas_hashCodekey_Small.Count;
prizeCount = 1;
EnsureScorePanel();
EnsureLayeredPool();
var records = layeredPool.BossGlodCoin(smallFishCount, tMP_CurrBossScore.transform.position);
AddRedPacket(records);
}
/// <summary>记录红包并开始分数滚动 + 加分</summary>
private void AddRedPacket(List<RedPacketRecord> records)
{
redPacketRecords.Add(records);
foreach (var r in records)
bossScoreValue += r.Amount;
_turretNum = CreateFishManager.Instance.currGameType.currSitData.consumeGoldNum;
GameManager.Instance.StartCoroutine(ShowBigPrize());
GameManager.Instance.StartCoroutine(JiaFenRoutine());
}
// ==================== 分数滚动 ====================
private IEnumerator ShowBigPrize()
{
if (_isJia) yield break;
_isJia = true;
yield return new WaitForSeconds(1f);
_turretNum = Random.Range((int)(_turretNum / 2), (int)_turretNum + 1);
while (currBossScoreValue < bossScoreValue)
{
currBossScoreValue += _turretNum;
if (currBossScoreValue > bossScoreValue)
currBossScoreValue = bossScoreValue;
tMP_CurrBossScore.text = currBossScoreValue.ToString();
yield return null;
}
_isJia = false;
}
private IEnumerator JiaFenRoutine()
{
yield return new WaitForSeconds(1.5f);
Transform parent = tMP_CurrBossScore.transform.parent;
GameObject addScorePrefab = CreateFishManager.Instance.dieFXPrefabAwardTmp_AddScore;
var records = redPacketRecords[0];
redPacketRecords.RemoveAt(0);
foreach (var item in records)
{
yield return new WaitForSeconds(0.15f);
var inst = Instantiate(addScorePrefab, parent.position, Quaternion.identity, parent);
inst.transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = CoinScript.NumAdd(item.Amount.ToString());
AudioManager.Instance.PlayerFX(61009);
}
}
// ==================== 死亡 ====================
public override void DieFish(RoomKillNotice obj = null)
{
isDieFish = true;
GameManager.Instance.cameraShake.ShakePresets.Explosion2D(3f, 4f, 1f);
if (obj != null)
poolNum = obj.gold;
var res = FishResourcesData.fishResourcesDatasDic[fishTypeID];
if (res.dieAudio != null && res.dieAudio.Count > 0)
AudioManager.Instance.PlayerFX(res.dieAudio[Random.Range(0, res.dieAudio.Count)]);
}
/// <summary>死亡后延迟飞分到座位</summary>
private IEnumerator YanChiDie()
{
yield return new WaitForSeconds(dieTime);
tMP_CurrBossScore.transform.parent.DOMove(v3, 0.5f).OnComplete(() =>
{
JiaFen?.Invoke(0);
Destroy(tMP_CurrBossScore.transform.parent.gameObject);
});
tMP_CurrBossScore.transform.parent
.DOMove(v3, 0.5f)
.OnComplete(() =>
{
JiaFen?.Invoke(0);
Destroy(tMP_CurrBossScore.transform.parent.gameObject);
});
}
}
+82 -49
View File
@@ -4,6 +4,7 @@ using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// Boss 爆奖事件基类
@@ -27,9 +28,10 @@ public class BJEventBase : MonoBehaviour
public int paoBei; // 炮倍
[Header("移动")]
public float showDelay = 2f; // 报完奖后停留时间(让玩家看清爆奖效果)
public float moveDuration = 0.5f; // UI 移动到座位的时间
public Ease moveEase = Ease.OutQuad; // 移动缓动曲线
public Vector3 startOffset = new Vector3(0, 0, -100); // 起始位置偏移(归零后再加此值,可手调)
public Vector3 startOffset = new Vector3(0, 0, -100);
[Header("加分")]
public float addScoreDuration = 0.5f; // 加分滚动持续时间
@@ -50,6 +52,7 @@ public class BJEventBase : MonoBehaviour
private SitPosData _targetSit; // 目标座位引用
private Coroutine _scoreCoroutine; // 加分协程
private GameObject _scoreBoard; // 自动创建的分数版(用于移动)
// ==================== 生命周期 ====================
private void Start()
@@ -107,7 +110,7 @@ public class BJEventBase : MonoBehaviour
if (prefab == null) return;
var board = Instantiate(prefab, parent);
board.transform.position = transform.position;
_scoreBoard = board;
var tmp = board.GetComponentInChildren<TextMeshProUGUI>();
if (tmp != null) tMP_Score = tmp;
@@ -119,12 +122,21 @@ public class BJEventBase : MonoBehaviour
{
if (isEffEnd) return;
isEffEnd = true;
MoveToSit();
// 停留 showDelay 秒让玩家看清爆奖效果 → 开始加分滚动
StartCoroutine(DelayThenScore());
}
/// <summary>触发红包特效(可在子类 Update/动画事件中重复调用)</summary>
private IEnumerator DelayThenScore()
{
yield return new WaitForSeconds(showDelay);
StartAddScore(); // → AddScoreRoutine → MoveToSit → OnScoreEnd
}
/// <summary>触发红包特效 + 开始滚分</summary>
public virtual void GoldEffect()
{
isGoldEffectStart = true;
BigPrize();
}
@@ -171,48 +183,57 @@ public class BJEventBase : MonoBehaviour
_targetSit = sits[posID];
}
/// <summary>将爆奖 UI 从当前位置移动到击杀者座位</summary>
/// <summary>分数版飞回到座位位置,爆奖对象本身不动</summary>
public virtual void MoveToSit()
{
if (CreateFishManager.Instance == null || CreateFishManager.Instance.currGameType == null)
// 没有分数版 → 直接进入加分
if (_scoreBoard == null && tMP_Score == null)
{
OnMoveComplete();
OnScoreEnd();
return;
}
var sits = CreateFishManager.Instance.currGameType.list_Sits;
if (posID < 0 || posID >= sits.Count || sits[posID] == null)
// 获取座位坐标
Vector3 seatPos;
if (_targetSit != null)
{
OnMoveComplete();
seatPos = _targetSit.transform.position;
if (_targetSit.currentTurret != null)
seatPos = _targetSit.currentTurret.transform.position;
}
else if (CreateFishManager.Instance != null && CreateFishManager.Instance.currGameType != null)
{
var sits = CreateFishManager.Instance.currGameType.list_Sits;
if (posID >= 0 && posID < sits.Count && sits[posID] != null)
{
_targetSit = sits[posID];
seatPos = _targetSit.transform.position;
if (_targetSit.currentTurret != null)
seatPos = _targetSit.currentTurret.transform.position;
}
else
{
OnScoreEnd();
return;
}
}
else
{
OnScoreEnd();
return;
}
_targetSit = sits[posID];
Transform sitTransform = _targetSit.transform;
// 获取座位上的目标位置(优先用当前炮台位置)
Vector3 targetPos = sitTransform.position;
if (_targetSit.currentTurret != null)
{
targetPos = _targetSit.currentTurret.transform.position;
}
// DOTween 移动到座位
transform.DOMove(targetPos, moveDuration)
// 移动分数版到座位
Transform moveTarget = _scoreBoard != null ? _scoreBoard.transform : tMP_Score.transform.parent;
moveTarget.DOMove(seatPos, moveDuration)
.SetEase(moveEase)
.OnComplete(() =>
{
OnMoveComplete();
// 停留 0.5 秒 → 加分 → 销毁
DOVirtual.DelayedCall(0.5f, () => OnScoreEnd());
});
}
/// <summary>移动到座位完成 → 开始加分</summary>
protected virtual void OnMoveComplete()
{
isScoreStart = true;
StartAddScore();
}
// ==================== 爆奖(发红包) ====================
/// <summary>
/// 执行一次爆奖(发红包)。可在动画事件中多次调用。
@@ -224,13 +245,21 @@ public class BJEventBase : MonoBehaviour
{
if (isScoreEnd) return;
BigPrize(minCount, maxCount);
// 执行红包并累加分数(爆奖阶段不显示,等停留 2s 后再滚分)
var records = BigPrize(minCount, maxCount);
if (records != null)
{
foreach (var r in records)
currScore += (int)r.Amount;
}
currBJCount++;
// 达到总次数 → 标记爆奖结束
// 达到总次数 → 标记结束并触发移动到座位
if (totalBJCount > 0 && currBJCount >= totalBJCount)
{
isGoldEffectStart = false;
EffEnd(); // → MoveToSit → 加分滚分 → JiaFen → die
}
}
@@ -261,28 +290,32 @@ public class BJEventBase : MonoBehaviour
/// <summary>默认加分滚动协程</summary>
protected virtual IEnumerator AddScoreRoutine()
{
// 根据炮倍计算每次步进值
int stepBase = Mathf.Max(1, paoBei / 10);
float elapsed = 0f;
while (elapsed < addScoreDuration && currScore < maxScore)
// CallBJ 已累加完 → 直接用
if (currBJCount > 0)
{
int step = UnityEngine.Random.Range(stepBase, stepBase * 5);
currScore = Mathf.Min(currScore + step, maxScore);
maxScore = currScore;
if (tMP_Score != null)
tMP_Score.text = currScore.ToString();
elapsed += Time.deltaTime * 0.2f; // 控制滚动速度
tMP_Score.text = maxScore.ToString();
yield return null;
}
else
{
// 雷龙风格滚分(paoBei*2 ~ paoBei*5 步进)
while (currScore < maxScore - paoBei)
{
int step = Random.Range(paoBei * 2, paoBei * 5);
currScore += step;
if (tMP_Score != null)
tMP_Score.text = currScore.ToString();
yield return null;
}
if (tMP_Score != null)
tMP_Score.text = maxScore.ToString();
yield return new WaitForSeconds(0.5f);
}
// 最终值
currScore = maxScore;
if (tMP_Score != null)
tMP_Score.text = maxScore.ToString();
OnScoreEnd();
// 加分完毕 → 分数版飞回座位 → 结束后 JiaFen → die
MoveToSit();
}
/// <summary>加分完成</summary>
@@ -855,7 +855,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b07d998904933ba4f9d354ffbf366054, type: 3}
m_Name:
m_EditorClassIdentifier:
hasScorePanel: 1
tMP_Score: {fileID: 0}
scorePanelPrefab: {fileID: 6975063179180105496, guid: 3098188d5a351294099bcec3fd687086,
type: 3}
@@ -864,12 +863,13 @@ MonoBehaviour:
scoreCount: 0
posID: 0
paoBei: 0
showDelay: 3
moveDuration: 0.5
moveEase: 6
startOffset: {x: 0, y: 0, z: -100}
addScoreDuration: 0.5
isSelf: 0
totalBJCount: 0
totalBJCount: 1
currBJCount: 0
isEffEnd: 0
isScoreStart: 0
@@ -18,6 +18,28 @@ public class FLZY_TSK_BOSS : MonsterControl_BossBase
{
base.DieFish(obj);
CreateFishManager.Instance.Id_DieFish_NotFX(guid);
action_effect_DieAward = (o) =>
{
if (obj == null) return;
foreach (var item in CreateFishManager.Instance.currGameType.list_Sits)
{
if (item.user == obj.userId)
{
var v = o.GetComponent<BJEventBase>();
v.Init(
obj.gold, // goldCount
item.posID, // posID
(int)item.consumeGoldNum, // paobei
JiaFen // action<int>
);
}
}
};
}
public override void OnDisable()
{
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7e9826e32a685724eab56f9d96f7c5e1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &7819309518249865421
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1138873142606774, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_Name
value: 1594 Variant
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalPosition.y
value: -10.219999
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalPosition.z
value: 29.73
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4821737002055278, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: -0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7746029e15a6b9e439505cd22efbf3c3, type: 3}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0aa5c951aa81de34e8bfaf4d74337231
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &2354058327267580535
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1697717181861688, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_Name
value: 1594_PT Variant
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4352938232866974, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8c5a0a74fb5ddcd47abbdfe715e47e3f, type: 3}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c47f6124f1ba6a24a85de996740b13aa
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,50 @@
using Assets.MyGame.Scripts.Net.WebResponses;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FLZY_ZDX_BOSS : MonsterControl_BossBase
{
public override void OnMoveUpdata()
{
base.OnMoveUpdata();
if (moveTime >= monsterData.moveLine.moveTime)
{
CreateFishManager.Instance.Id_DieFish_NotFX(guid);
}
}
public override void DieFish(RoomKillNotice obj = null)
{
base.DieFish(obj);
CreateFishManager.Instance.Id_DieFish_NotFX(guid);
action_effect_DieAward = (o) =>
{
if (obj == null) return;
foreach (var item in CreateFishManager.Instance.currGameType.list_Sits)
{
if (item.user == obj.userId)
{
var v = o.GetComponent<BJEventBase>();
v.Init(
obj.gold, // goldCount
item.posID, // posID
(int)item.consumeGoldNum, // paobei
JiaFen // action<int>
);
}
}
};
}
public override void OnDisable()
{
//GetComponent<Animator>().enabled = false;
currEffect_DieAward.SetActive(true);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34d4d6e3bc1b0644f943ef31b10bef2b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -12,5 +12,16 @@
吞噬鲲1;-1070.7098,7.9665914;-898.63153,7.9665914;-739.2997,7.9665914;-589.5278,7.9665914;-433.38257,1.5933182;-283.61066,4.779955;-140.212,7.9665914;22.306456,4.779955;152.95856,7.9665914;258.11755,11.153228;340.97012,4.779955;427.0093,14.339865;506.6752,14.339865;583.1545,11.153228;653.2605,17.5265;723.3665,14.339865;790.2859,11.153228;860.39185,20.713137;924.1246,27.08641;994.2306,17.5265;1080.2698,20.713137;1134.4426,20.713137;1217.2952,20.713137
吞噬鲲2;1098.4336,31.5477;955.0349,25.811754;805.9003,28.679728;691.18146,22.94378;576.4625,22.94378;456.00766,22.94378;329.81686,22.94378;200.75809,14.339864;57.359455,28.679728;-71.69932,34.415672;-238.04173,25.811754;-312.60904,22.94378;-433.06387,25.811754;-530.57495,28.679728;-589.5278,33.459682;-630.95404,33.459682;-685.12683,30.273046;-729.73975,30.273046;-777.5393,27.08641;-818.9656,27.08641;-869.9518,30.273046;-936.87115,33.459682;-1000.6039,33.459682;-1073.8965,33.459682
禄存星君1;-1063.9678,1.3167919;-854.7256,8.019226;-827.5836,8.019226;-795.5067,8.019226;-760.9624,8.019226;-726.4181,10.486679;-682.0039,12.954132;-642.52466,17.889038;-615.3827,15.421585;-580.8384,15.421585;-551.229,5.551773;-514.21716,8.019226;-477.20535,17.889038;-447.59592,15.421585;-403.1818,12.954132;-366.17,10.486679;-329.15823,10.486679;-289.679,3.08432;-225.52518,5.551773;-188.51343,0.61686707;-146.56671,0.61686707;-104.620026,0.61686707;-45.401154,-4.318039;11.35025,-1.8505859;58.231842,-1.8505859;90.30873,3.08432;132.25543,-4.318039;169.26721,-9.252945;201.3441,-4.318039;245.75824,-4.318039;309.91202,-9.252945;364.19598,-6.785492;396.27286,-6.785492;435.7521,-9.252945;482.6337,-9.252945;531.9828,-6.785492;561.59216,-9.252945;596.13654,-11.720394;635.6157,-14.187847;670.1601,-11.720394;699.76953,-6.785492;734.31384,-14.187847;761.4558,-14.187847;788.59784,-14.187847;813.27234,-11.720394;865.08887,-6.785492;897.1658,-6.785492;934.1775,-6.785492;966.2544,-9.252945
禄存星君2;57.93885,185.66766;-218.58743,185.66766;-503.0145,188.30124;-732.1363,190.93483;-1011.29614,193.5684;337.09872,183.03407;566.2205,177.7669;774.2736,190.93483;1006.029,188.30124
禄存星君2;21.222687,178.02277;337.09872,183.03407;566.2205,177.7669;774.2736,190.93483;1006.029,188.30124;-228.37747,178.02277;-455.9541,172.51688;-722.0719,179.85806;-929.46027,185.36395;-1124.0016,187.19925
禄存星君3;-342.36588,562.27014;-474.04507,396.35434;-555.68616,156.69824;-416.10623,-53.98847;-160.64859,-127.72881;131.6792,-177.76689;355.53378,-219.90424;516.1824,-246.24007;692.6325,-254.14082;824.3117,-264.67517;1019.19684,-283.11026
荧光水母1;-1028.5662,-523.06;-707.3896,-324.84814;-446.7776,-183.5304;-224.70688,-80.75387;6.5403137,5.5050087;298.3523,117.45802;492.89355,192.70514;736.98785,299.15225;1012.2821,504.70532
荧光水母2;959.0586,-546.9188;707.6231,-350.5423;478.21118,-225.74222;223.10515,-104.61271;-2.6361542,-38.542076;-239.38925,44.04621;-371.53052,111.95213;-591.7659,211.05807;-711.0601,291.81107;-868.89557,376.23465;-1023.06036,506.54062;-1096.4722,587.29364
深渊鳄鱼1;-1153.3663,9.175598;-839.5308,5.5050087;-571.5777,14.681484;-277.93045,11.010895;-77.88326,18.352077;151.52864,11.010895;283.66992,16.51678;496.56415,12.846191;650.72894,18.352077;847.1055,27.528553;1179.294,31.199142
深渊鳄鱼2;1168.2822,31.199142;900.3291,44.04621;683.7643,34.869736;476.37592,36.70503;285.5052,33.03444;112.98744,33.03444;-107.247986,33.03444;-299.95398,34.869736;-533.0365,33.03444;-711.0601,31.199142;-870.73083,25.693256;-1136.8486,27.528553
深海灯笼鱼1;-1105.6486,-45.883255;-865.225,-53.22444;-689.0366,-45.883255;-488.98938,-60.56562;-351.34225,-58.730324;-221.03629,-64.23621;-85.22444,-71.577385;41.410934,-73.41268;160.70512,-75.24798;313.0346,-80.75387;447.01117,-78.91857;553.4583,-82.589165;650.72894,-82.589165;762.68195,-86.25976;880.14087,-78.91857;1032.4703,-78.91857;1137.0822,-77.083275;1186.6351,-73.41268
深海灯笼鱼2;1204.9882,-51.389145;1037.9762,-49.55385;909.5056,-55.05974;773.6937,-53.22444;676.4231,-55.05974;500.23474,-64.23621;320.3758,-62.400917;173.5522,-64.23621;6.5403137,-60.56562;-143.95389,-62.400917;-268.75397,-56.895027;-360.51874,-58.730324;-498.1659,-60.56562;-644.9895,-55.05974;-766.119,-51.389145;-890.91907,-51.389145;-1030.4015,-53.22444;-1114.8251,-55.05974
霸王蟹1;-421.0835,523.0583;-490.8247,400.09348;-564.2365,293.64636;-613.7895,185.36395;-602.7777,-5.5067596;-518.3541,-146.8245;-378.8717,-234.91867;-189.83627,-260.61282;45.081528,-288.14224;267.15222,-273.45987;430.49353,-267.954;553.4583,-256.94223;707.6231,-245.93045;834.2585,-244.09515;1048.988,-218.40103
霸王蟹2;1129.741,-49.55385;931.5292,-71.577385;799.3879,-97.27152;623.1995,-110.1186;423.15234,-124.80096;226.77574,-141.3186;59.763885,-157.83627;-193.50687,-150.49509;-353.17755,-95.436226;-529.3659,25.693256;-606.4483,122.96391;-694.5425,229.41104;-804.6602,256.94046;-968.00146,300.98755;-1083.6251,326.68167
霸王蟹3;-1151.531,14.681484;-975.34265,1.8344193;-727.5778,-7.3420563;-571.5777,-9.177353;-397.22464,-20.189125;-248.56573,-23.859718;-112.753876,-34.87149;46.91681,-38.542076;213.9287,-47.71855;360.75232,-47.71855;536.9406,-58.730324;674.58777,-67.90681;821.41144,-93.60093;918.682,-117.45977;1098.541,-163.34216;1148.094,-179.8598
远古龙龟1;-1120.23,63.238796;-916.3172,65.81997;-640.1315,60.65762;-493.00446,63.238796;-314.90335,65.81997;-178.10107,58.076447;-7.7434998,55.49527;136.8023,52.914093;260.69873,55.49527;394.91986,60.65762;531.7221,63.238796;686.59265,58.076447;831.1385,58.076447;983.4278,60.65762;1195.0842,65.81997
远古龙龟2;1166.6912,40.008217;918.8984,40.008217;722.7291,50.33292;531.7221,47.751743;345.8775,47.751743;162.61407,42.589394;10.324738,40.008217;-154.87048,50.33292;-322.64688,50.33292;-544.6279,47.751743;-709.8232,45.170567;-823.3949,45.170567;-988.5901,40.008217;-1130.5547,40.008217