void playSound(object resource) { SkillClientBehaviourItem behaviour = resource as SkillClientBehaviourItem; string[] sounds = behaviour.soundResID.Split('|'); string sound = sounds[UnityEngine.Random.Range(0, sounds.Length)]; SkillClientBehaviour.PlaySound(uint.Parse(sound), behaviour.loopSound, mLoopClientBehaviours); }
/// <summary> /// 通过前端表现的资源, 转换为task, 加入到taskManager中. /// </summary> private void loadClientBehaviourTask(uint clientBehaviourResID) { SkillClientBehaviourItem resource = (clientBehaviourResID != uint.MaxValue) ? DataManager.SkillClientBehaviourTable[clientBehaviourResID] as SkillClientBehaviourItem : null; if (resource == null) { return; } // skillclientbehaviour中的换武器, 拉近镜头, 循环的(特效, 声音, 动作), 只在技能第一次进入使用阶段时播放. // 其他情况下, 在任意一次进入使用阶段都会播放. bool chargingOrFirstUseState = (mState == ActionSkillState.Charging || FirstUseState); if (!string.IsNullOrEmpty(resource.soundResID) && (chargingOrFirstUseState || !resource.loopSound)) { mTaskManager.AddTask(new SkillUtilities.Task(0, playSound, resource)); } if (!string.IsNullOrEmpty(resource.userAnimationName) && (chargingOrFirstUseState || !resource.loopUserAnimation)) { mTaskManager.AddTask(new SkillUtilities.Task(0, playAnimation, resource)); } if (!string.IsNullOrEmpty(resource.weaponAnimationName) && (chargingOrFirstUseState || !resource.loopWeaponAnimation)) { mTaskManager.AddTask(new SkillUtilities.Task(0, playWeaponAnimation, resource)); } if (resource.cameraDist2Player >= 0f && chargingOrFirstUseState) { mTaskManager.AddTask(new SkillUtilities.Task(0, playCameraEffect, resource)); } if (resource.effectID_0 != uint.MaxValue && (chargingOrFirstUseState || !resource.loopEffect_0)) { mTaskManager.AddTask(new SkillUtilities.Task(resource.effectStartTime_0, create3DEffect, new EffectCreateStructure() { bindpoint = resource.effectBp_0, effectID = resource.effectID_0, loop = resource.loopEffect_0 })); } if (resource.effectID_1 != uint.MaxValue && (chargingOrFirstUseState || !resource.loopEffect_1)) { mTaskManager.AddTask(new SkillUtilities.Task(resource.effectStartTime_1, create3DEffect, new EffectCreateStructure() { bindpoint = resource.effectBp_1, effectID = resource.effectID_1, loop = resource.loopEffect_1 })); } }
private bool checkSkillClientBehaviour() { DataType myName = DataType.DATA_SKILL_BEHAVIOUR; IDictionaryEnumerator itr = DataManager.SkillClientBehaviourTable.GetEnumerator(); while (itr.MoveNext()) { SkillClientBehaviourItem item = itr.Value as SkillClientBehaviourItem; uint[] sounds = Utility.SplitToUnsigned(item.soundResID); foreach (uint resID in sounds) { if (!checkLink(myName, item.resID, DataType.DATA_SOUND, resID)) { return(false); } } if (item.effectID_0 != uint.MaxValue) { if (!checkParam(item.effectStartTime_0 != uint.MaxValue, myName, item.resID, "特效起始时间 I")) { return(false); } if (!checkLink(myName, item.resID, DataType.DATA_EFFECT, item.effectID_0)) { return(false); } } if (item.effectID_1 != uint.MaxValue) { if (!checkParam(item.effectStartTime_1 != uint.MaxValue, myName, item.resID, "特效起始时间 II")) { return(false); } if (!checkLink(myName, item.resID, DataType.DATA_EFFECT, item.effectID_1)) { return(false); } } } // foreach (int key in DataManager.SkillClientBehaviourTable.Keys) // { // // } return(true); }
void playCameraEffect(object resource) { SkillClientBehaviourItem behaviour = resource as SkillClientBehaviourItem; CameraController.Instance.PlayCameraEffect(behaviour.cameraDist2Player, CameraController.Instance.Distance, behaviour.cameraMoveTime / 1000f); }
void playWeaponAnimation(object resource) { SkillClientBehaviourItem behaviour = resource as SkillClientBehaviourItem; SkillClientBehaviour.PlayWeaponAnimation(mOwner, behaviour.weaponAnimationName, behaviour.loopWeaponAnimation, mLoopClientBehaviours); }