Merge pull request 'add sfx for normal attack' (#385) from feature/normal-attack-sfx into develop
Reviewed-on: https://git.pthub.vn/Unity/perfect-world-unity/pulls/385
This commit is contained in:
@@ -271,6 +271,52 @@ namespace BrewMonster
|
||||
"胧族变身月仙男",
|
||||
"胧族变身月仙女",
|
||||
};
|
||||
public Dictionary<int,List<string>> m_aWeaponSFX = new Dictionary<int,List<string>>()
|
||||
{
|
||||
{0, new List<string>{"item/weaponattack/1hshorta", "item/weaponattack/1hshortb", "item/weaponattack/1hshortc"}},
|
||||
{1, new List<string>{"item/weaponattack/1hshorta", "item/weaponattack/1hshortb", "item/weaponattack/1hshortc"}},
|
||||
{2, new List<string>{"item/weaponattack/2hlonga", "item/weaponattack/2hlongb", "item/weaponattack/2hlongc", "item/weaponattack/2hlongd"}},
|
||||
{3, new List<string>{"item/weaponattack/1hshorta", "item/weaponattack/1hshortb", "item/weaponattack/1hshortc"}},
|
||||
{4, new List<string>{"item/weaponattack/2hlonga", "item/weaponattack/2hlongb", "item/weaponattack/2hlongc", "item/weaponattack/2hlongd"}},
|
||||
{6, new List<string>{"item/weaponattack/bow", "item/weaponattack/bowb", "item/weaponattack/drawbow"}},
|
||||
{7, new List<string>{"item/weaponattack/bow", "item/weaponattack/bowb", "item/weaponattack/drawbow"}},
|
||||
{8, new List<string>{"item/weaponattack/fista", "item/weaponattack/fistb", "item/weaponattack/fistc", "item/weaponattack/fistd"}},
|
||||
{9, new List<string>{"item/weaponattack/bow", "item/weaponattack/bowb", "item/weaponattack/drawbow"}},
|
||||
{10, new List<string>{"item/weaponattack/fista", "item/weaponattack/fistb", "item/weaponattack/fistc", "item/weaponattack/fistd"}},
|
||||
// {0, new List<string>{"item/weaponattack/1hshorta", "item/weaponattack/1hshortb", "item/weaponattack/1hshortc"}},
|
||||
// {1, new List<string>{"item/weaponattack/2hheavya", "item/weaponattack/2hheavyb", "item/weaponattack/2hheavyc", "item/weaponattack/2hheavyd"}},
|
||||
// {2, new List<string>{"item/weaponattack/2hlonga", "item/weaponattack/2hlongb", "item/weaponattack/2hlongc", "item/weaponattack/2hlongd"}},
|
||||
// {3, new List<string>{"item/weaponattack/bow", "item/weaponattack/bowb", "item/weaponattack/drawbow"}},
|
||||
// {4, new List<string>{"item/weaponattack/fista", "item/weaponattack/fistb", "item/weaponattack/fistc", "item/weaponattack/fistd"}},
|
||||
// {5, new List<string>{"item/weaponattack/magic", "item/weaponattack/magicb"}},
|
||||
};
|
||||
public Dictionary<int,List<string>> m_aWeaponHitSFX = new Dictionary<int,List<string>>()
|
||||
{
|
||||
{0, new List<string>{"item/weaponattack/hitsword", "item/weaponattack/hitswordbig"}},
|
||||
{1, new List<string>{"item/weaponattack/hitsword", "item/weaponattack/hitswordbig"}},
|
||||
{2, new List<string>{"item/weaponattack/hitmace", "item/weaponattack/hitmacebig"}},
|
||||
{3, new List<string>{"item/weaponattack/hithammer", "item/weaponattack/hithammerbig"}},
|
||||
{4, new List<string>{"item/weaponattack/hitaxe", "item/weaponattack/hitaxebig"}},
|
||||
{6, new List<string>{"item/weaponattack/hitthrow"}},
|
||||
{7, new List<string>{"item/weaponattack/hitthrow"}},
|
||||
{8, new List<string>{"item/weaponattack/hithand"}},
|
||||
{9, new List<string>{"item/weaponattack/hitthrow"}},
|
||||
{10, new List<string>{"item/weaponattack/hithand"}},
|
||||
// {0, new List<string>{"item/weaponattack/hitaxe", "item/weaponattack/hitaxebig"}},
|
||||
// {1, new List<string>{"item/weaponattack/hithammer", "item/weaponattack/hithammerbig"}},
|
||||
// {2, new List<string>{"item/weaponattack/hitblade", "item/weaponattack/hitbladebig"}},
|
||||
// {3, new List<string>{"item/weaponattack/hitdagger"}},
|
||||
// {4, new List<string>{"item/weaponattack/hitfist"}},
|
||||
// {5, new List<string>{"item/weaponattack/hithand"}},
|
||||
// {6, new List<string>{"item/weaponattack/hitstaff"}},
|
||||
// {7, new List<string>{"item/weaponattack/hitmace", "item/weaponattack/hitmacebig"}},
|
||||
// {8, new List<string>{"item/weaponattack/hitoriginal"}},
|
||||
// {9, new List<string>{"item/weaponattack/hitsword", "item/weaponattack/hitswordbig"}},
|
||||
// {10, new List<string>{"item/weaponattack/hittiger"}},
|
||||
// {11, new List<string>{"item/weaponattack/hitwhip"}},
|
||||
// {12, new List<string>{"item/weaponattack/hitthrow"}},
|
||||
// {13, new List<string>{"item/weaponattack/hitbow", "item/weaponattack/hitbowbig"}},
|
||||
};
|
||||
public static class Effect_type
|
||||
{
|
||||
public const int EFF_FACEPILL = 1;
|
||||
@@ -1631,11 +1677,13 @@ namespace BrewMonster
|
||||
|
||||
int nRand = UnityEngine.Random.Range(0, 4);
|
||||
string szAct = string.Empty;
|
||||
string szShapeName = string.Empty;
|
||||
GetShapeName(ref szShapeName);
|
||||
int weapon_type = GetShowingWeaponType();
|
||||
Debug.Log("PlayAttackAction: weapon_type=" + weapon_type);
|
||||
int nTime1 = 0, nTime2 = 0;
|
||||
int iAction = (int)PLAYER_ACTION_TYPE.ACT_ATTACK_1 + nRand;
|
||||
|
||||
string soundPath = m_aWeaponSFX[weapon_type][nRand%m_aWeaponSFX[weapon_type].Count];
|
||||
string hitSoundPath = m_aWeaponHitSFX[weapon_type][nRand%m_aWeaponHitSFX[weapon_type].Count];
|
||||
bool bHideFX = false;//!CECOptimize::Instance().GetGFX().CanShowAttack(GetCharacterID(), GetClassID());
|
||||
PLAYER_ACTION action = m_PlayerActions[iAction];
|
||||
|
||||
@@ -1654,12 +1702,19 @@ namespace BrewMonster
|
||||
// “起�? 动作(挥起)
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "起");
|
||||
int iTransTime = 200;
|
||||
//EventBus.PublishChannel(m_PlayerInfo.cid, new PlayActionEvent(szShapeName, szAct, iTransTime, true));
|
||||
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();
|
||||
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "落");
|
||||
queueActionEvent.SetData(szShapeName, szAct, SetApplyDamage, true, attackEvent, iTransTime,false);
|
||||
//EventBus.PublishChannelClass(m_PlayerInfo.cid, queueActionEvent);
|
||||
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())
|
||||
@@ -1705,7 +1760,6 @@ namespace BrewMonster
|
||||
// nTime1 = m_pPlayerModel.GetComActTimeSpanByName(szAct);
|
||||
|
||||
szAct = EC_Utility.BuildActionName(action, weapon_type, "落", szActionMiddleName);
|
||||
queueActionEvent.SetData(szShapeName, szAct, SetApplyDamage, false, attackEvent, 0, false);
|
||||
//EventBus.PublishChannelClass(m_PlayerInfo.cid, queueActionEvent);
|
||||
m_pActionController.QueueNonSkillActionWithName(iAction, szAct, 0, false, false, true, false);
|
||||
|
||||
@@ -3911,7 +3965,7 @@ namespace BrewMonster
|
||||
public CECAttackEvent AttackEvent;
|
||||
public bool IsHitAnim;
|
||||
public bool IsForceStopPrevious;
|
||||
public bool IsLoop;
|
||||
public bool IsLoop;
|
||||
public QueueActionEvent(string animationName, Action<bool, CECAttackEvent> setFlag, bool isHitAnim,
|
||||
CECAttackEvent attackEvent, int iTransTime, bool isForceStopPrevious = false, bool isLoop = false)
|
||||
{
|
||||
|
||||
@@ -681,16 +681,20 @@ public class CECModel
|
||||
{
|
||||
foreach(var eventInfo in eventInfoList)
|
||||
{
|
||||
//0 is sound event
|
||||
if (eventInfo is FX_BASE_INFO sfx)
|
||||
if(eventInfo.m_nType == 0)
|
||||
{
|
||||
if(sfx.m_strFilePaths != null && sfx.m_strFilePaths.Count > 0)
|
||||
//0 is sound event
|
||||
if (eventInfo is FX_BASE_INFO sfx)
|
||||
{
|
||||
string soundpath = AFile.NormalizePath(sfx.m_strFilePaths[0]);
|
||||
soundpath = soundpath.ToLower();
|
||||
SFXManager.Instance.PlaySkillSfxAtPointAsync(soundpath, Vector3.zero).Forget();
|
||||
if(sfx.m_strFilePaths != null && sfx.m_strFilePaths.Count > 0)
|
||||
{
|
||||
string soundpath = AFile.NormalizePath(sfx.m_strFilePaths[0]);
|
||||
soundpath = soundpath.ToLower();
|
||||
SFXManager.Instance.PlaySkillSfxAtPointAsync(soundpath, Vector3.zero).Forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user