/// <summary> /// 播放另一种怪物的死亡特效 /// </summary> public void AddMonsterEffect(uint uid) { SpacecraftEntity ship = m_GameplayProxy.GetEntityById <SpacecraftEntity>(uid); if (ship != null && ship.GetSkinRootTransform()) { ship.GetSkinRootTransform().gameObject.SetActive(false); EffectController dropItemFX = EffectManager.GetInstance().CreateEffect(m_JujubeBattlefield.Basic.Value.MonsterTeleportHome, EffectManager.GetEffectGroupNameInSpace(false)); dropItemFX.transform.SetParent(null, false); dropItemFX.transform.localPosition = ship.GetSkinRootTransform().position; WwiseUtil.PlaySound(10002, false, null); } }
/// <summary> /// 给导演挂倒计时特效 /// </summary> private void AddEffectOnAIAction() { if (m_CurrentAIUid > 0) { SpacecraftEntity ship = m_GameplayProxy.GetEntityById <SpacecraftEntity>((uint)m_CurrentAIUid); if (ship != null && ship.GetSkinRootTransform() != null) { m_AIActionEffect = EffectManager.GetInstance().CreateEffect(m_JujubeBattlefield.Director.Value.MonsterLairCountdown, EffectManager.GetEffectGroupNameInSpace(false)); m_AIActionEffect.transform.SetParent(ship.GetSkinRootTransform(), false); WwiseUtil.PlaySound(10003, false, null); UIManager.Instance.StartCoroutine(DelayToStopEffect(m_AIActionEffect, 9.8f)); } } }
/// <summary> /// 寻找大矿及其附属矿 /// </summary> /// <returns></returns> private ModelInfo[] FindSubsidiaryMine() { List <ModelInfo> target = new List <ModelInfo>(); ModelInfo mine = new ModelInfo(); mine.perfab = m_CfgEternityProxy.GetModel(m_NearestTarget.GetNPCTemplateVO().Model).AssetName; mine.position = Vector3.zero; mine.rotation = Vector3.zero; mine.scale = Vector3.one; target.Add(mine); m_TargetList.Add(m_NearestTarget.UId()); Transform mainShip = m_NearestTarget.GetSkinRootTransform(); foreach (SpacecraftEntity ship in m_GameplayProxy.GetEntities <SpacecraftEntity>(KHeroType.htMine)) { if (ship.GetHeroType() != KHeroType.htMine) { continue; } if (ship.GetCurrentState().GetMainState() == EnumMainState.Dead) { continue; } if (ship.GetAttribute(AttributeName.kHP) <= 0) { continue; } if (ship.m_EntityFatherOwnerID == m_NearestTarget.UId()) { m_TargetList.Add(ship.UId()); ModelInfo model = new ModelInfo(); model.perfab = m_CfgEternityProxy.GetModel(ship.GetNPCTemplateVO().Model).AssetName; Transform curr = ship.GetSkinRootTransform(); Vector3 localPoint = mainShip.InverseTransformPoint(curr.TransformPoint(Vector3.zero)); model.position = localPoint; model.rotation = curr.localEulerAngles; model.scale = Vector3.one; target.Add(model); } } return(target.ToArray()); }
public override void CalculateNextTargets(ref List <SkillTarget> targetList) { targetList.Clear(); string targetListStr = ""; foreach (var pair in m_LockTargeMap) { SpacecraftEntity target = pair.Key; TargetLockInfo lockInfo = pair.Value; for (int iLockTime = 0; iLockTime < lockInfo.LockTimes; iLockTime++) { targetList.Add(new SkillTarget(target, target.GetSkinRootTransform().position)); } targetListStr += target.name + ", "; } SLog("选择目标释放. {0}", targetListStr); }
/// <summary> /// 播放入侵2效果(专门给区域-精英战用的) /// </summary> private void PlayInvadedTwo(ulong aiUid) { if (aiUid <= 0) { return; } SpacecraftEntity AI = m_GameplayProxy.GetEntityById <SpacecraftEntity>((uint)aiUid); if (AI) { Npc npc = AI.GetNPCTemplateVO(); if (npc.Behavior > 0) { PlotBehavior plotBehavior = m_CfgEternityProxy.PlotBehaviorsByKey((uint)npc.Behavior); /// 特效 string fightBeginFx = plotBehavior.FightBeginFx; if (!string.IsNullOrEmpty(fightBeginFx)) { SpacecraftEntity main = m_GameplayProxy.GetEntityById <SpacecraftEntity>(m_GameplayProxy.GetMainPlayerUID()); m_AIActionEffect = EffectManager.GetInstance().CreateEffect(fightBeginFx, EffectManager.GetEffectGroupNameInSpace(true)); m_AIActionEffect.transform.SetParent(main.GetSkinRootTransform(), false); m_AIActionEffect.SetCreateForMainPlayer(true); /// 特效声音 if (plotBehavior.FightBeginFxSound > 0) { WwiseUtil.PlaySound((int)plotBehavior.FightBeginFxSound, false, null); } } /// HUD if (Enum.TryParse(plotBehavior.FightBeginHud, out UIPanel panelName)) { MSG_WarningHUDInfo info = new MSG_WarningHUDInfo(); info.languageId = plotBehavior.FightBeginHudText; info.time = plotBehavior.FightBeginHudTime; UIManager.Instance.OpenPanel(panelName, info); } CreateSoundBox(aiUid); if (plotBehavior.FightBeginVideo > 0) { SendNotification((int)plotBehavior.FightBeginVideo); } } } }
public void SyncDiscoverPrecious(S2C_SYNC_PLAYER_DISCOVER_PRECIOUS msg) { int type = msg.discover_type; /// 发现信号 0是飞出 if (type == (int)PlayerDiscoverPreciousType.DiscoverSignal) { if (msg.is_in != 0) { SpacecraftEntity main = m_GameplayProxy.GetEntityById <SpacecraftEntity>(m_GameplayProxy.GetMainPlayerUID()); m_Effect = EffectManager.GetInstance().CreateEffect(m_CfgEternityProxy.GetGamingConfig(1).Value.Treasure.Value.Effect.Value.DiscoverCameraEffect, EffectManager.GetEffectGroupNameInSpace(true)); m_Effect.transform.SetParent(main.GetSkinRootTransform(), false); m_Effect.SetCreateForMainPlayer(true); WwiseUtil.PlaySound((int)WwiseMusic.InTreasure_FX_Sound, false, null); WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_treasure_event1, WwiseMusicPalce.Palce_1st, false, null); MsgDetectorShow msgDetectorShow = new MsgDetectorShow(); msgDetectorShow.Show = true; GameplayProxy gameplayProxy = Facade.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; Vector3 pos = gameplayProxy.ServerAreaOffsetToClientPosition(new Vector3(0, (float)msg.fY, 0)); msgDetectorShow.Height = pos.y; //todo 宝藏的高度 msgDetectorShow.MaxHeight = (float)msg.fR * 2f; //触发范围最大高度 Facade.SendNotification(NotificationName.MSG_DETECTOR_SHOW, msgDetectorShow); Facade.SendNotification(NotificationName.MSG_INTERACTIVE_SHOWTIP, HudNpcInteractiveFlagPanel.InteractiveTipType.Precious); } else { MsgDetectorShow msgDetectorShow = new MsgDetectorShow(); msgDetectorShow.Show = false; Facade.SendNotification(NotificationName.MSG_DETECTOR_SHOW, msgDetectorShow); Facade.SendNotification(NotificationName.MSG_INTERACTIVE_HIDETIP, HudNpcInteractiveFlagPanel.InteractiveTipType.Precious); } } /// 发现宝藏 0是飞出 else if (msg.is_in != 0 && type == (int)PlayerDiscoverPreciousType.DiscoverPrecious) { MsgDetectorShow msgDetectorShow = new MsgDetectorShow(); msgDetectorShow.Show = false; // WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_treasure_event2, WwiseMusicPalce.Palce_1st, false, null); } }
/// <summary> /// 播放全屏特效 /// </summary> private void AddEffectOnPlayer(int type = 0) { if (m_CurrentAIUid > 0 && !IsDead() && IsInSpace()) { string effPath = string.Empty; if (type == 1) { effPath = m_JujubeBattlefield.Basic.Value.InterferenceEffect; WwiseUtil.PlaySound((int)WwiseMusic.Interference_FX_Sound, false, null); } else { effPath = m_JujubeBattlefield.Director.Value.FailureSuicide; } SpacecraftEntity main = m_GameplayProxy.GetEntityById <SpacecraftEntity>(m_GameplayProxy.GetMainPlayerUID()); m_AIActionEffect = EffectManager.GetInstance().CreateEffect(effPath, EffectManager.GetEffectGroupNameInSpace(true)); m_AIActionEffect.transform.SetParent(main.GetSkinRootTransform(), false); m_AIActionEffect.SetCreateForMainPlayer(true); } }
/// <summary> /// 创建掉落物 /// </summary> /// <param name="uid">怪物唯一id</param> /// <param name="pos">怪物位置</param> /// <param name="type">1为new消息, 2为死亡消息</param> public void CreateDropItem(uint uid, SpacecraftEntity spe, int type) { ulong key = uid; if (!spe) { if (m_ChestInfoDic.ContainsKey(key)) { m_ChestInfoDic.Remove(key); } if (m_SpacecraftEntityDic.ContainsKey(key)) { Debug.Log("CreateDropItem !spe m_SpacecraftEntityDic remove key:" + key); m_SpacecraftEntityDic.Remove(key); } return; } if (type == 1 && !m_SpacecraftEntityDic.ContainsKey(key)) { m_SpacecraftEntityDic.Add(key, spe); } if (!m_ChestInfoDic.ContainsKey(uid)) { return; } if (m_ChestGosDic.ContainsKey(uid)) { return; } CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; PackageBoxAttr? pb = cfgEternityProxy.GetPackageBoxAttrByModelIdAndGrade(m_ChestInfoDic[uid].tid, m_ChestInfoDic[uid].shipgrade); if (!pb.HasValue) { return; } int modelid = pb.Value.BoxModel; Model?mdata = m_CfgEternityProxy.GetModel(modelid); if (string.IsNullOrEmpty(mdata.Value.AssetName)) /// (mdata.Value.AssetName.Equals(string.Empty)) { Debug.LogErrorFormat("DropItem model assetName is empty modelid {0}", modelid); return; } AssetUtil.InstanceAssetAsync(mdata.Value.AssetName, (pathOrAddress, returnObject, userData) => { if (returnObject != null) { if (!spe) { Debug.Log("InstanceAssetAsync CreateDropItem !spe m_SpacecraftEntityDic remove key:" + key); GameObject.Destroy(returnObject); m_SpacecraftEntityDic.Remove(key); m_ChestInfoDic.Remove(key); return; } GameObject go = (GameObject)returnObject; go.transform.SetParent(spe.GetRootTransform(), false); if (go.transform.parent == null) { m_ChestGosDic.Remove(uid); return; } //美术不去 这玩意没有加collide需求为啥不给去? 吐个槽 xswl BoxCollider box = go.GetComponentInChildren <BoxCollider>(); if (box) { box.enabled = false; } else { Debug.LogWarning("找不到没必要的boxcollider 美术去了还是换了别的碰撞"); } spe.GetSkinRootTransform().gameObject.SetActive(false); m_ChestGosDic.Add(key, go); AddBrothOrPickEffect(key, 1); } else { Debug.LogError(string.Format("资源加载成功,但返回null, pathOrAddress = {0}", pathOrAddress)); } }); }
/// <summary> /// 根据状态触发效果 /// </summary> private void Triggle(ulong npcid) { if (npcid > 0) //&& m_AIBossState[m_CurrentAIUid] == AIPlotState.Invaded) { SpacecraftEntity ship = m_GameplayProxy.GetEntityById <SpacecraftEntity>((uint)npcid); switch (m_AIBossState[npcid].m_AIPlotState) { case AIPlotState.Invaded: if (ship != null && m_LastAIUid != m_CurrentAIUid) { //播放入侵语音1 SendNotification((int)m_JujubeBattlefield.SystemVoice.Value.AccessArea, PlayInvaded); } break; case AIPlotState.Invaded2: if (ship != null && m_AIBossState[npcid].m_InScene == 0) { PlayInvadedTwo(npcid); } break; case AIPlotState.CloseInvaded2: DestroySoundBox(npcid); break; case AIPlotState.MonsterRetreat: if (m_PlayerInBattle && !IsDead()) { //播放撤退1音乐1016to1019 if (ship != null && ship.GetSkinRootTransform() != null) { WwiseUtil.PlaySound((int)SoundID.AIAreaEvent, false, ship.GetSkinRootTransform()); } UIManager.Instance.StartCoroutine(DelayToPlayVoice(2f, (int)m_JujubeBattlefield.SystemVoice.Value.MobRetreat)); WwiseUtil.PlaySound((int)SoundID.AIAreaMonsterRetreat, false, null); } break; case AIPlotState.BeginCallingBoss: if (m_PlayerInBattle && !IsDead()) { //播放激战音乐 WwiseUtil.PlaySound((int)SoundID.AIAreaCallingBossSuccess, false, null); } break; case AIPlotState.CallingBossSuccess: if (m_PlayerInBattle && !IsDead()) { //播放进入boss战音乐 SendNotification((int)m_JujubeBattlefield.SystemVoice.Value.BossBattle); } break; case AIPlotState.MonsterRetreatFail: case AIPlotState.CallingBossFail: if (!IsDead()) { //播放胜利1音乐 if (ship != null) { SendNotification((int)m_JujubeBattlefield.SystemVoice.Value.WipeOutMobs); } } OpenCountDownTimePanel(false); break; case AIPlotState.DefeatBoss: if (!IsDead()) { //播放胜利2音乐 WwiseUtil.PlaySound((int)SoundID.AIAreaDefeatBoss, false, null); } OpenCountDownTimePanel(false); break; case AIPlotState.BeginBossTimeout: if (!IsDead() && m_PlayerInBattle) { //播放10秒倒计时音乐1013to1016 SendNotification((int)m_JujubeBattlefield.SystemVoice.Value.TenSeconds); WwiseUtil.PlaySound((int)SoundID.AIAreaBeginBossTimeout, false, null); } AddEffectOnAIAction(); break; case AIPlotState.BossTimeout: OpenCountDownTimePanel(false); AddEffectOnPlayer(); break; case AIPlotState.LostPlayer: OnLostPlayer(npcid); break; case AIPlotState.PlayerOutOfScene: OpenCountDownTimePanel(false); break; } } }