fix gfx hit not sych with animation. Fix wrong animation timing with long weapon. Add animation scaling speed
This commit is contained in:
@@ -67,7 +67,6 @@ namespace BrewMonster.Scripts
|
||||
public override bool Tick(float dwDeltaTime)
|
||||
{
|
||||
base.Tick(dwDeltaTime * 1000);
|
||||
//BMLogger.Log($" m_OverTimeCnt m_dwCounter:{m_OverTimeCnt.m_dwCounter}, m_dwPeriod:{m_OverTimeCnt.m_dwPeriod} ");
|
||||
if (m_OverTimeCnt.IncCounter(dwDeltaTime * 1000,out float fCounter,out float fPeriod))
|
||||
{
|
||||
m_bFinished = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BrewMonster.Managers;
|
||||
using BrewMonster.Managers;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.PerfectWorld.Scripts.Vfx;
|
||||
using BrewMonster.Scripts;
|
||||
@@ -1688,20 +1688,20 @@ namespace BrewMonster
|
||||
}
|
||||
|
||||
// melee attack
|
||||
CECAttackEvent pAttack1 = CECAttacksMan.Instance.AddMeleeAttack(
|
||||
CECAttackEvent pAttack = CECAttacksMan.Instance.AddMeleeAttack(
|
||||
GetPlayerInfo().cid, idTarget, idWeapon, dwModifier, nDamage, nTimeFly);
|
||||
|
||||
if (pAttack1 != null)
|
||||
if (pAttack != null)
|
||||
{
|
||||
if (!IsDead() && (dwModifier & (uint)MOD.MOD_RETORT) == 0
|
||||
&& (dwModifier & (uint)MOD.MOD_ATTACK_AURA) == 0
|
||||
&& PlayAttackAction(nAttackSpeed, ref piAttackTime, pAttack1)
|
||||
&& PlayAttackAction(nAttackSpeed, ref piAttackTime, pAttack)
|
||||
&& (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
pAttack1.m_bSignaled = true;
|
||||
pAttack.m_bSignaled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1721,11 +1721,11 @@ namespace BrewMonster
|
||||
CECAttackerEvents attackerEvents = CECAttacksMan.Instance.FindAttackByAttacker(GetPlayerInfo().cid);
|
||||
if (attackerEvents)
|
||||
{
|
||||
CECAttackEvent pAttack1 = attackerEvents.Find(idSkill, nSection);
|
||||
if (pAttack1 != null)
|
||||
pAttack = attackerEvents.Find(idSkill, nSection);
|
||||
if (pAttack != null)
|
||||
{
|
||||
// Ãæ¹¥»÷µÄ·ÇµÚÒ»´ÎÉ˺¦ÏûÏ¢
|
||||
pAttack1.AddTarget(idTarget, dwModifier, nDamage);
|
||||
pAttack.AddTarget(idTarget, dwModifier, nDamage);
|
||||
goto EXIT;
|
||||
}
|
||||
else
|
||||
@@ -1755,7 +1755,6 @@ namespace BrewMonster
|
||||
&& PlaySkillAttackAction(idSkill, nAttackSpeed, ref unusedInt, nSection, pAttack)
|
||||
&& (dwModifier & (uint)MOD.MOD_BEAT_BACK) == 0)
|
||||
{
|
||||
pAttack.m_bSignaled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1805,38 +1804,30 @@ namespace BrewMonster
|
||||
// ==============================
|
||||
if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND)
|
||||
{
|
||||
string szActRise = EC_Utility.BuildActionName(action, weapon_type, "起");
|
||||
string szActFall = EC_Utility.BuildActionName(action, weapon_type, "落");
|
||||
|
||||
nTime1 = m_pPlayerCECModel.GetComActTimeSpanByName(szActRise);
|
||||
nTime2 = m_pPlayerCECModel.GetComActTimeSpanByName(szActFall);
|
||||
|
||||
// 调整动画速度以匹配攻击速度 / Adjust animation speed to match attack speed
|
||||
if (nAttackSpeed > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nAttackSpeed;
|
||||
if (vScale > 0f)
|
||||
m_pPlayerCECModel.SetPlaySpeed(vScale);
|
||||
}
|
||||
|
||||
// “起�? 动作(挥起)
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "起");
|
||||
int iTransTime = 200;
|
||||
m_pActionController.PlayNonSkillActionWithName(iAction, szAct, true, iTransTime, bHideFX, attackEvent,COMACT_FLAG_MODE_ONCE_MULTIIGNOREGFX);
|
||||
//swing sfx
|
||||
//workaround for sound effect delay, it need to trigger via weapon combine action
|
||||
SFXManager.Instance.PlaySkillSfxAtPointAsync(soundPath, Vector3.zero,iTransTime/1000f).Forget();
|
||||
m_pActionController.PlayNonSkillActionWithName(iAction, szActRise, true, iTransTime, bHideFX, attackEvent, COMACT_FLAG_MODE_ONCE_MULTIIGNOREGFX);
|
||||
// if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.PlayActionByName(_GenWeaponActionName(szActRise, m_iGender), 1.0f, true, iTransTime, true, iAction, bHideFX);
|
||||
SFXManager.Instance.PlaySkillSfxAtPointAsync(soundPath, Vector3.zero, iTransTime / 1000f).Forget();
|
||||
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "落");
|
||||
m_pActionController.QueueNonSkillActionWithName(iAction, szAct, 0, false, bHideFX);
|
||||
|
||||
//hit sfx
|
||||
//workaround for sound effect delay, it need to trigger via weapon combine action
|
||||
//.1f is a magic number to make sure the sound effect is triggered after the action is finished
|
||||
SFXManager.Instance.PlaySkillSfxAtPointAsync(hitSoundPath, Vector3.zero,iTransTime/1000f+.1f).Forget();
|
||||
|
||||
//PlayNonSkillActionWithName(iAction, szAct, true, 200, true, ref pActFlag, COMACT_FLAG_MODE_ONCE_MULTIIGNOREGFX);gagága
|
||||
/*
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.PlayActionByName(_GenWeaponActionName(szAct, m_iGender), 1.0f, true, 200, true, iAction, bHideFX);
|
||||
|
||||
nTime1 = _pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
|
||||
// “收” 动作(挥下)
|
||||
szAct = $"{action.data.action_prefix}_{action.data.action_weapon_suffix[weapon_type].suffix}Âä";
|
||||
QueueNonSkillActionWithName(iAction, szAct, 0, false, bHideFX);
|
||||
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.QueueAction(_GenWeaponActionName(szAct, m_iGender), 0, iAction, false, false, bHideFX);
|
||||
|
||||
nTime2 = _pPlayerModel.GetComActTimeSpanByName(szAct);*/
|
||||
m_pActionController.QueueNonSkillActionWithName(iAction, szActFall, 0, false, bHideFX);
|
||||
// if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.QueueAction(_GenWeaponActionName(szActFall, m_iGender), 0, iAction, false, false, bHideFX);
|
||||
SFXManager.Instance.PlaySkillSfxAtPointAsync(hitSoundPath, Vector3.zero, iTransTime / 1000f + .1f).Forget();
|
||||
}
|
||||
// ==============================
|
||||
// Air Attack
|
||||
@@ -1851,59 +1842,49 @@ namespace BrewMonster
|
||||
GetProfession() == (int)PROFESSION.PROF_MONK ||
|
||||
GetProfession() == (int)PROFESSION.PROF_GHOST)
|
||||
{
|
||||
szActionMiddleName = "空中翅膀"; // tấn công trên không
|
||||
szActionMiddleName = "空中翅膀"; // Air with wings / 空中翅膀
|
||||
}
|
||||
else
|
||||
{
|
||||
szActionMiddleName = "空中飞剑"; // rơi xuống hoặc bay
|
||||
szActionMiddleName = "空中飞剑"; // Air with sword / 空中飞剑
|
||||
}
|
||||
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "起", szActionMiddleName);
|
||||
//EventBus.PublishChannel(m_PlayerInfo.cid, new PlayActionEvent(szShapeName, szAct, 200, true));
|
||||
m_pActionController.PlayNonSkillActionWithName(iAction, szAct, true, 200);
|
||||
string szActRiseAir = EC_Utility.BuildActionName(action, weapon_type, "起", szActionMiddleName);
|
||||
string szActFallAir = EC_Utility.BuildActionName(action, weapon_type, "落", szActionMiddleName);
|
||||
|
||||
nTime1 = m_pPlayerCECModel.GetComActTimeSpanByName(szActRiseAir);
|
||||
nTime2 = m_pPlayerCECModel.GetComActTimeSpanByName(szActFallAir);
|
||||
|
||||
// 调整动画速度以匹配攻击速度 / Adjust animation speed to match attack speed
|
||||
if (nAttackSpeed > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nAttackSpeed;
|
||||
if (vScale > 0f)
|
||||
m_pPlayerCECModel.SetPlaySpeed(vScale);
|
||||
}
|
||||
|
||||
m_pActionController.PlayNonSkillActionWithName(iAction, szActRiseAir, true, 200);
|
||||
// if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.PlayActionByName(_GenWeaponActionName(szAct, m_iGender), 1.0f, true, 200, true, iAction, bHideFX);
|
||||
|
||||
// nTime1 = m_pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "落", szActionMiddleName);
|
||||
//EventBus.PublishChannelClass(m_PlayerInfo.cid, queueActionEvent);
|
||||
m_pActionController.QueueNonSkillActionWithName(iAction, szAct, 0, false, false, true, false);
|
||||
// pRightHandWeapon.PlayActionByName(_GenWeaponActionName(szActRiseAir, m_iGender), 1.0f, true, 200, true, iAction, bHideFX);
|
||||
|
||||
m_pActionController.QueueNonSkillActionWithName(iAction, szActFallAir, 0, false, false, true, false);
|
||||
// if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.QueueAction(_GenWeaponActionName(szAct, m_iGender), 0, iAction, false, false, bHideFX);
|
||||
|
||||
// nTime2 = m_pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
// pRightHandWeapon.QueueAction(_GenWeaponActionName(szActFallAir, m_iGender), 0, iAction, false, false, bHideFX);
|
||||
}
|
||||
|
||||
// ==============================
|
||||
// Kết thúc bằng FightStand
|
||||
// Queue FightStand / 结束动作
|
||||
// ==============================
|
||||
PLAYER_ACTION stand_action = m_PlayerActions[(int)PLAYER_ACTION_TYPE.ACT_FIGHTSTAND];
|
||||
szAct = EC_Utility.BuildActionName(stand_action, 0);
|
||||
int iTranstime = 300;
|
||||
m_pActionController.QueueNonSkillActionWithName(iAction, szAct, iTranstime, false, false, true, false);
|
||||
/* QueueNonSkillActionWithName(ACT_FIGHTSTAND, szAct, 300, false, bHideFX, true);
|
||||
m_pActionController.QueueNonSkillActionWithName(iAction, szAct, 300, false, false, true, false);
|
||||
// if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.QueueAction(_GenWeaponActionName(szAct, m_iGender), 300, iAction, false, false, bHideFX, true);
|
||||
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.QueueAction(_GenWeaponActionName(szAct, m_iGender), 300, iAction, false, false, bHideFX, true);*/
|
||||
// if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.SetPlaySpeed(vScale);
|
||||
|
||||
// ==============================
|
||||
// Điều chỉnh tốc độ phát animation theo tốc độ tấn công
|
||||
// ==============================
|
||||
/* if (nAttackSpeed > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nAttackSpeed;
|
||||
if (vScale > 0f)
|
||||
{
|
||||
m_pPlayerModel.SetPlaySpeed(vScale);
|
||||
|
||||
if (pRightHandWeapon != null && IsUsingMagicWeapon())
|
||||
pRightHandWeapon.SetPlaySpeed(vScale);
|
||||
}
|
||||
}
|
||||
|
||||
attackTime = nTime1 + nTime2;*/
|
||||
attackTime = nTime1 + nTime2;
|
||||
|
||||
// ==============================
|
||||
// Cập nhật vị trí weapon hanger (vũ khí)
|
||||
@@ -2601,29 +2582,38 @@ namespace BrewMonster
|
||||
|
||||
var atkMan = CECAttacksMan.Instance;
|
||||
|
||||
// int nExecuteTime = GNET::ElementSkill::GetExecuteTime(idSkill, 0); // 获取技能执行时间 / Get skill execute time
|
||||
int nExecuteTime = ElementSkill.GetExecuteTime((uint)idSkill, 0); // 临时值 / Temporary value
|
||||
|
||||
if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND)
|
||||
{
|
||||
szAct = EC_Utility.BuildActionName(data, weapon_type, "_施放起_");
|
||||
GetSkillSectionActionName(ref szAct, idSkill, nSection);
|
||||
nTime1 = m_pPlayerCECModel.GetComActTimeSpanByName(szAct); // 获取动作时长 / Get action time span
|
||||
var pAct = m_pPlayerCECModel.GetComActByName(szAct);
|
||||
if (pAct!=null) bInfinite |= pAct.IsLooping();
|
||||
|
||||
string szAct2 = EC_Utility.BuildActionName(data, weapon_type, "_施放落_");
|
||||
GetSkillSectionActionName(ref szAct2, idSkill, nSection);
|
||||
nTime2 = m_pPlayerCECModel.GetComActTimeSpanByName(szAct2);
|
||||
pAct = m_pPlayerCECModel.GetComActByName(szAct2);
|
||||
if (pAct!=null) bInfinite |= pAct.IsLooping();
|
||||
|
||||
// 调整动画速度以匹配攻击速度 / Adjust animation speed to match attack speed
|
||||
if (!bInfinite && nExecuteTime > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nExecuteTime;
|
||||
if (vScale > 0)
|
||||
{
|
||||
m_pPlayerCECModel.SetPlaySpeed(vScale * 1.2f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!PlaySkillAttackActionWithName(idSkill, szAct, bHideFX, attackEvent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// nTime1 = m_pPlayerModel.GetComActTimeSpanByName(szAct); // 获取动作时长 / Get action time span
|
||||
// pAct = m_pPlayerModel.GetComActByName(szAct);
|
||||
// if (pAct) bInfinite |= pAct.IsInfinite();
|
||||
nTime1 = 1000; // 临时值 / Temporary value
|
||||
|
||||
szAct = EC_Utility.BuildActionName(data, weapon_type, "_施放落_");
|
||||
GetSkillSectionActionName(ref szAct, idSkill, nSection);
|
||||
QueueSkillAttackActionWithName(idSkill, szAct, 0, bHideFX);
|
||||
|
||||
// nTime2 = m_pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
// pAct = m_pPlayerModel.GetComActByName(szAct);
|
||||
// if (pAct) bInfinite |= pAct.IsInfinite();
|
||||
nTime2 = 1000; // 临时值 / Temporary value
|
||||
QueueSkillAttackActionWithName(idSkill, szAct2, 0, bHideFX);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2645,6 +2635,25 @@ namespace BrewMonster
|
||||
szActionMiddleName += "_施放起_";
|
||||
szAct = EC_Utility.BuildActionName(data, weapon_type, szActionMiddleName);
|
||||
GetSkillSectionActionName(ref szAct, idSkill, nSection);
|
||||
nTime1 = m_pPlayerCECModel.GetComActTimeSpanByName(szAct);
|
||||
var pAct = m_pPlayerCECModel.GetComActByName(szAct);
|
||||
if (pAct!=null) bInfinite |= pAct.IsLooping();
|
||||
|
||||
string szAct2Air = $"{data.ActionPrefix}_{szActionMiddleName}_施法行_{data.action_weapon_suffix[weapon_type].Suffix}";
|
||||
GetSkillSectionActionName(ref szAct2Air, idSkill, nSection);
|
||||
nTime2 = m_pPlayerCECModel.GetComActTimeSpanByName(szAct2Air);
|
||||
pAct = m_pPlayerCECModel.GetComActByName(szAct2Air);
|
||||
if (pAct!=null) bInfinite |= pAct.IsLooping();
|
||||
|
||||
// 调整动画速度以匹配攻击速度 / Adjust animation speed to match attack speed
|
||||
if (!bInfinite && nExecuteTime > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nExecuteTime;
|
||||
if (vScale > 0)
|
||||
{
|
||||
m_pPlayerCECModel.SetPlaySpeed(vScale * 1.2f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!PlaySkillAttackActionWithName(idSkill, szAct, bHideFX, attackEvent))
|
||||
{
|
||||
@@ -2654,39 +2663,15 @@ namespace BrewMonster
|
||||
// if (pRightHandWeapon && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.PlayActionByName(_GenWeaponActionName(szAct, m_iGender), 1.0f, true, 200, true, ACT_CASTSKILL, bHideFX);
|
||||
|
||||
// nTime1 = m_pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
// pAct = m_pPlayerModel.GetComActByName(szAct);
|
||||
// if (pAct) bInfinite |= pAct.IsInfinite();
|
||||
nTime1 = 1000; // 临时值 / Temporary value
|
||||
|
||||
szAct = $"{data.ActionPrefix}_{szActionMiddleName}_施法行_{data.action_weapon_suffix[weapon_type].Suffix}";
|
||||
GetSkillSectionActionName(ref szAct, idSkill, nSection);
|
||||
QueueSkillAttackActionWithName(idSkill, szAct, 0, bHideFX);
|
||||
QueueSkillAttackActionWithName(idSkill, szAct2Air, 0, bHideFX);
|
||||
|
||||
// if (pRightHandWeapon && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.QueueAction(_GenWeaponActionName(szAct, m_iGender), 0, ACT_CASTSKILL, false, false, bHideFX);
|
||||
|
||||
// nTime2 = m_pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
// pAct = m_pPlayerModel.GetComActByName(szAct);
|
||||
// if (pAct) bInfinite |= pAct.IsInfinite();
|
||||
nTime2 = 1000; // 临时值 / Temporary value
|
||||
}
|
||||
|
||||
// int nExecuteTime = GNET::ElementSkill::GetExecuteTime(idSkill, 0); // 获取技能执行时间 / Get skill execute time
|
||||
int nExecuteTime = 2000; // 临时值 / Temporary value
|
||||
|
||||
// 调整动画速度以匹配攻击速度 / Adjust animation speed to match attack speed
|
||||
if (!bInfinite)
|
||||
{
|
||||
if (nExecuteTime > 0)
|
||||
{
|
||||
float vScale = (nTime1 + nTime2) / (float)nExecuteTime;
|
||||
// m_pPlayerModel.SetPlaySpeed(vScale * 1.2f);
|
||||
|
||||
// if (pRightHandWeapon && IsUsingMagicWeapon())
|
||||
// pRightHandWeapon.SetPlaySpeed(vScale * 1.2f);
|
||||
}
|
||||
|
||||
piAttackTime = nTime1 + nTime2;
|
||||
}
|
||||
else
|
||||
@@ -4091,7 +4076,8 @@ namespace BrewMonster
|
||||
public bool IsLoop;
|
||||
public CECAttackEvent AttackEvent;
|
||||
public int Rank;
|
||||
public PlayActionEvent(string animationName, int iTransTime, bool isForceStopPrevious = false, CECAttackEvent attackEvent = null, bool isLoop = false)
|
||||
public float PlaySpeed;
|
||||
public PlayActionEvent(string animationName, int iTransTime, bool isForceStopPrevious = false, CECAttackEvent attackEvent = null, bool isLoop = false, float playSpeed = 1.0f)
|
||||
{
|
||||
this.ChannelAct = null;
|
||||
this.AnimationName = animationName;
|
||||
@@ -4100,8 +4086,9 @@ namespace BrewMonster
|
||||
AttackEvent = attackEvent;
|
||||
IsLoop = isLoop;
|
||||
Rank = 0;
|
||||
PlaySpeed = playSpeed;
|
||||
}
|
||||
public PlayActionEvent(ref ChannelAct channelAct, string animationName, int iTransTime, bool isForceStopPrevious = false, CECAttackEvent attackEvent = null, bool isLoop = false, int rank = 0)
|
||||
public PlayActionEvent(ref ChannelAct channelAct, string animationName, int iTransTime, bool isForceStopPrevious = false, CECAttackEvent attackEvent = null, bool isLoop = false, int rank = 0, float playSpeed = 1.0f)
|
||||
{
|
||||
this.ChannelAct = channelAct;
|
||||
this.AnimationName = animationName;
|
||||
@@ -4110,6 +4097,7 @@ namespace BrewMonster
|
||||
AttackEvent = attackEvent;
|
||||
IsLoop = isLoop;
|
||||
Rank = rank;
|
||||
PlaySpeed = playSpeed;
|
||||
}
|
||||
}
|
||||
public struct PLAYER_ACTION
|
||||
|
||||
@@ -359,7 +359,7 @@ public class A3DCombActDynData
|
||||
// if (!m_bNoFx)
|
||||
// TriggerSFxFromEventList();
|
||||
Resume();
|
||||
UpdateAct(0);
|
||||
UpdateAct(0, m_pECModel.GetPlaySpeed());
|
||||
if(true /*!m_bNoFx*/)
|
||||
{
|
||||
LoadFXFromEventList();
|
||||
@@ -499,6 +499,13 @@ public class A3DCombActDynData
|
||||
public void Stop(bool bStopAct, bool bForceStopFx = false )
|
||||
{
|
||||
RemoveAllActiveFx();
|
||||
if (ActiveAttackEvent != null)
|
||||
{
|
||||
Debug.Log($"[Nam Debug]Stop: ActiveAttackEvent.m_bSignaled = true, Action name: {m_pAct.m_strName}");
|
||||
ActiveAttackEvent.m_bSignaled = true;
|
||||
}
|
||||
|
||||
|
||||
// FlushDamageInfo();
|
||||
|
||||
// ClearParentInfo();
|
||||
@@ -530,11 +537,9 @@ public class A3DCombActDynData
|
||||
// if (pChannel)
|
||||
// pChannel->StopAction(m_pAct->GetRank(m_nChannel));
|
||||
}
|
||||
public void UpdateAct(uint dwDeltaTime)
|
||||
public void UpdateAct(uint dwDeltaTime, float fPlaySpeed = 1f)
|
||||
{
|
||||
m_dwTimeSpan += (int)dwDeltaTime;
|
||||
if (m_pECModel.IsActionStopped())
|
||||
return;
|
||||
|
||||
if(true/*!m_bNoFx*/)
|
||||
UpdateEvent((uint)m_dwTimeSpan, 0);
|
||||
@@ -581,7 +586,7 @@ public class A3DCombActDynData
|
||||
{
|
||||
m_nCurActLoop = 0;
|
||||
m_nCurActIndex++;
|
||||
EventBus.PublishChannel(m_pECModel.GetId(), new PlayActionEvent( pNext.m_strName, m_nTransTime, false, ActiveAttackEvent, pNext.CalcLoopNum()==-1 && pNext.GetTimeSpan() > 10));
|
||||
EventBus.PublishChannel(m_pECModel.GetId(), new PlayActionEvent( pNext.m_strName, m_nTransTime, false, null, pNext.CalcLoopNum()==-1 && pNext.GetTimeSpan() > 10, fPlaySpeed));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -629,19 +634,7 @@ public class A3DCombActDynData
|
||||
}
|
||||
public bool IsActionStopped()
|
||||
{
|
||||
if(m_pAct.IsLooping())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(m_nCurLoop >= m_pAct.m_nLoops)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(m_pAct.m_ActLst.Count == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return m_pAct.m_ActLst.Count == 0 || (m_pAct.m_nLoops != -1 && m_nCurLoop >= m_pAct.m_nLoops);
|
||||
}
|
||||
void LoopCurAct(ACTION_INFO pCur, uint dwDeltaTime)
|
||||
{
|
||||
@@ -650,7 +643,6 @@ public class A3DCombActDynData
|
||||
void LoopNext(uint dwDeltaTime)
|
||||
{
|
||||
m_nCurLoop++;
|
||||
|
||||
if (!IsActionStopped())
|
||||
{
|
||||
RemoveAllActiveFx();
|
||||
@@ -1118,6 +1110,7 @@ public class CECModel
|
||||
private Transform m_transform;
|
||||
private bool m_bAbsTrack = false;
|
||||
private bool m_bFirstActPlayed = false;
|
||||
private float m_fPlaySpeed = 1.0f;
|
||||
public bool InheritParentId() => m_bInheritParentId;
|
||||
public void SetId(int nId) => m_nId = nId;
|
||||
public int GetId() => m_nId;
|
||||
@@ -1507,13 +1500,34 @@ public class CECModel
|
||||
return m_pMapModel.m_ActionMap.TryGetValue(szActName, out A3DCombinedAction combinedAction) ? combinedAction : null;
|
||||
}
|
||||
//Final trigger function
|
||||
public int GetComActTimeSpanByName(string szActName)
|
||||
{
|
||||
A3DCombinedAction combinedAction = GetComActByName(szActName);
|
||||
if (combinedAction == null || combinedAction.m_ActLst == null || combinedAction.m_ActLst.Count == 0)
|
||||
return 0;
|
||||
|
||||
int totalMs = 0;
|
||||
foreach (var actInfo in combinedAction.m_ActLst)
|
||||
{
|
||||
if (actInfo == null || string.IsNullOrEmpty(actInfo.m_strName))
|
||||
continue;
|
||||
AnimationClip clip = GetAnimationClip(actInfo.m_strName);
|
||||
if (clip != null)
|
||||
totalMs += Mathf.Max(1, Mathf.RoundToInt(clip.length * 1000f));
|
||||
}
|
||||
return totalMs;
|
||||
}
|
||||
public void SetPlaySpeed(float vScale)
|
||||
{
|
||||
m_fPlaySpeed = vScale;
|
||||
}
|
||||
public float GetPlaySpeed() => m_fPlaySpeed;
|
||||
public bool QueueAction(int nChannel, string szActName, int nTransTime, uint dwUserData, bool bForceStopPrevAct, bool bCheckTailDup, bool bNoFx, bool bResetSpeed, bool bResetActFlag, CECAttackEvent attackEvent=null, uint dwNewFlagMode=0){
|
||||
if(szActName == null || szActName == string.Empty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
A3DCombinedAction pComAct = GetComActByName(szActName);
|
||||
|
||||
if (pComAct == null)
|
||||
return false;
|
||||
|
||||
@@ -1586,7 +1600,7 @@ public class CECModel
|
||||
}
|
||||
public bool Tick(uint dwDeltaTime)
|
||||
{
|
||||
UpdateChannelActs(dwDeltaTime);
|
||||
UpdateChannelActs((uint)(dwDeltaTime * m_fPlaySpeed));
|
||||
return true;
|
||||
}
|
||||
void UpdateChannelActs(uint dwUpdateTime)
|
||||
@@ -1606,13 +1620,11 @@ public class CECModel
|
||||
bActFinished = node.m_pActive.IsActionStopped();
|
||||
else
|
||||
bActFinished = node.m_pActive.IsActionStopped();
|
||||
|
||||
if (bActFinished)
|
||||
{
|
||||
if (node.m_dwFlagMode != COMACT_FLAG_MODE_NONE && node.m_pActFlag)
|
||||
{
|
||||
node.m_pActFlag = true;
|
||||
|
||||
if (node.m_dwFlagMode != COMACT_FLAG_MODE_ONCE_MULTIIGNOREGFX)
|
||||
node.m_dwFlagMode = (int)COMACT_FLAG_MODE_NONE;
|
||||
|
||||
@@ -1621,14 +1633,15 @@ public class CECModel
|
||||
if (node.m_QueuedActs.Count > 0)
|
||||
{
|
||||
A3DCombActDynData pNext = node.m_QueuedActs[0];
|
||||
|
||||
if (pNext.GetStopPrevAct())
|
||||
{
|
||||
node.m_pActive.Stop(true);
|
||||
//StopChildrenAct();
|
||||
}
|
||||
else
|
||||
{
|
||||
node.m_pActive.Stop(false);
|
||||
}
|
||||
|
||||
// script
|
||||
//m_pMapModel->OnScriptPlayAction(this, i, pNext->GetComAct()->GetName());
|
||||
@@ -1641,7 +1654,7 @@ public class CECModel
|
||||
node.m_pActive = null;
|
||||
node.m_pActive = pNext;
|
||||
node.m_pActive.Play(i, 1f, node.m_pActive.GetTransTime(), 0/**m_EventMasks[i]*/, true, m_bAbsTrack, pNext.GetNoFxFlag());
|
||||
//pNext.UpdateAct(dwUpdateTime);
|
||||
pNext.UpdateAct(dwUpdateTime, m_fPlaySpeed);
|
||||
node.m_QueuedActs.RemoveAt(0);
|
||||
m_bAbsTrack = false;
|
||||
}
|
||||
@@ -1653,7 +1666,7 @@ public class CECModel
|
||||
}
|
||||
else
|
||||
{
|
||||
node.m_pActive.UpdateAct(dwUpdateTime);
|
||||
node.m_pActive.UpdateAct(dwUpdateTime, m_fPlaySpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace BrewMonster
|
||||
}
|
||||
|
||||
int iTransTime = 0;
|
||||
EventBus.PublishChannel(m_pPlayer.GetPlayerInfo().cid, new PlayActionEvent(szActName,iTransTime));
|
||||
//EventBus.PublishChannel(m_pPlayer.GetPlayerInfo().cid, new PlayActionEvent(szActName,iTransTime));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user