Exemple #1
0
    /// <summary>
    /// 创建音乐盒子
    /// </summary>
    /// <param name="aiUid"></param>
    private void CreateSoundBox(ulong aiUid)
    {
        if (aiUid <= 0 || m_AISoundBoxs.ContainsKey(aiUid))
        {
            /// TODO.
            /// or play sound box begin music
            Debug.LogError("aiUid is 0 or Plot repeated trigger the Invaded2");
            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);
                if (plotBehavior.FightBeginSound > 0)
                {
                    GameObject soundBox = WwiseManager.CreatTAkAmbientSphereBox((int)plotBehavior.FightBeginSound, (int)plotBehavior.FightEndSound);
                    soundBox.transform.position = AI.GetRootTransform().position;
                    float scale = plotBehavior.SoundBoxSize;
                    soundBox.transform.localScale = new Vector3(scale, scale, scale);
                    m_AISoundBoxs.Add(aiUid, soundBox);
                }
            }
        }
    }
Exemple #2
0
    /// <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);
                }
            }
        }
    }