Exemplo n.º 1
0
    public void OnFinish()
    {
        double loadSceneFinishTime = DateTime.Now.Ticks;

        ResourceEx.Collect();

        AdorningManager.Init();
        GrassAdorningManager.Init();

        ImageSetting.OnSceneLoadFinish();
        ImageSetting.Apply(true);
        //ImageSetting.ApplySceneImageSetting(SceneResInfoManager.CurrentActiveInstance, true);
        LightingEffectFactory.DisableDeadEffect();

        // 场景地图资源加载完后开始播放背景音乐
        //SoundManager.CreateUISound(StageManager.Instance.getSoundID());


        if (SoldierCamera.MainInstance() != null)
        {
            SoldierCamera.MainInstance <SoldierCamera>().updateCameraParam(m_curMapID, -1);
        }

        loadSceneFinishTime  = DateTime.Now.Ticks - loadSceneFinishTime;
        loadSceneFinishTime *= 0.0000001f;
        Debug.Log("场景加载完成阶段,耗时:" + loadSceneFinishTime);


        double time = DateTime.Now.Ticks - sceneLoadBegainTime;

        time *= 0.0000001f;
        Debug.Log("SceneLoad::DoTask 资源加载成功,场景名称 = " + m_SceneName + ",耗时:" + time);

        InvokeSceneLoadFinishEvent(m_SceneName);


        StartCoroutine(WaitTransitionFinish());

        InvokeSceneTransitionStartEvent(m_SceneName);
    }
Exemplo n.º 2
0
    ///// <summary>
    ///// 死亡前的碰撞层
    ///// </summary>
    //private int nOldCollisionLayer = -1;
    // 进入状态
    public bool OnEnter(IntPtr lParam)
    {
        //退出假死状态
        if (m_pFSM != null && m_pFSM.animatorCtrl != null)
        {
            m_pFSM.animatorCtrl.Dying = false;
        }

        Debug.Log("on OnEnter CreaturePosture_Dead " + this.m_pFSM.name);
        if (m_pFSM.showLog)
        {
            Trace.Log(m_pFSM.name + "=======OnEnter CreaturePosture_Dead======");
        }

        cmd_creature_die context = IntPtrHelper.toData <cmd_creature_die>(lParam);

        if (m_pFSM.showLog)
        {
            Trace.Log("DeadInterval:" + context.nDeadInterval);
            Trace.Log("reborn second:" + context.nInterval);
        }



        m_pFSM.rebornTick = context.nInterval - context.nDeadInterval;
        if (m_pFSM.rebornTick <= 0)
        {
            Trace.Log("rebornTick <= 0!");
            //return false;                   吃鸡地图,这个时差是0,所以先不要返回
        }
        m_nDeadInterval = context.nDeadInterval;

        //暂时让角色死亡不让射线检测该层
        //if (!m_pFSM.isHero)
        //{
        //    nOldLayer = m_pFSM.gameObject.layer;
        //    if (m_pFSM.gameObject.layer != LayerMask.NameToLayer(Config.LayerTransparentFX))
        //    {
        //        GameUtil.SetLayer(LayerMask.NameToLayer(Config.LayerNeutrality), m_pFSM.gameObject, true);
        //    }

        //    //m_pFSM.gameObject.layer = LayerMask.NameToLayer(Config.LayerPlayerFriend);
        //    //if (m_pFSM.SkinConfig.ScreenCastObject != null)
        //    //{
        //    //    m_pFSM.SkinConfig.ScreenCastObject.layer = LayerMask.NameToLayer(Config.LayerPlayerFriend);
        //    //}
        //}

        SkillCtrl sk = m_pFSM.GetComponent <SkillCtrl>();

        if (sk)
        {
            sk.enabled = false;
        }

        SoldierController sco = m_pFSM.GetComponent <SoldierController>();

        if (sco)
        {
            sco.dead = true;
        }

        if (m_pFSM.animator)
        {
            m_pFSM.animator.SetTrigger("Dead");

            m_pFSM.animator.ResetTrigger("Reborn");
        }

        //关闭死亡时要求关闭的光效
        LightingEffectManager light = m_pFSM.GetComponent <LightingEffectManager>();

        if (light)
        {
            light.CloseLightingWhenDead();
        }

        startTick = GameLogicAPI.getSyncTickCount(); // GameLogicAPI.getTickCount();
        endTick   = startTick + (uint)m_pFSM.rebornTick;
        tick_cameraSwitchAfterDead = startTick + m_pFSM.cameraSwitchAfterDead;

        if (m_pFSM.isHero)
        {
            //GFxGameHud hud = SFGFxMovieManager.GetWindow<GFxGameHud>();
            //if (SFGFxMovieManager.CheckTheMovieCanUse(hud))
            //{
            //    hud.ShowReliveTime(((float)m_pFSM.rebornTick));
            //}
            ScreenREC.GetInstance().SwitchRECState(ScreenREC.EMRECState.EMREC_STOP);

            //ImageEffects.ImageEffectManager.API_EnableImageEffect<ImageEffects.FullScreenGray>();
            if (ImageSetting.GetData().currImageQuality == ImageQuality.Fastest)
            {
                LightingEffectFactory.EnableDeadEffect();
                ImageEffects.ImageEffectManager.API_DisableImageEffect <ImageEffects.FullScreenSaturation>();
                ImageEffects.ImageEffectManager.API_DisableImageEffect <ImageEffects.DepthOfFieldScatter>();
            }
            else
            {
                LightingEffectFactory.DisableDeadEffect();
                ImageEffects.ImageEffectManager.API_EnableImageEffect <ImageEffects.FullScreenSaturation>();
                ImageEffects.ImageEffectManager.API_DisableImageEffect <ImageEffects.DepthOfFieldScatter>();
            }
        }

        //死亡不碰撞
        if (m_pFSM.controller)
        {
            //nOldCollisionLayer = m_pFSM.gameObject.layer;
            //m_pFSM.gameObject.layer = LayerMask.NameToLayer(Config.LayerIngoreRayCast);
            m_pFSM.pickableCount = 0;
        }

        int nEntityID = m_pFSM.entityID;

        U3D_Render.EntityView ev = EntityFactory.getPlayerViewByID(nEntityID);

        //添加金币掉落光效
        if (GameLogicAPI.isInWarScene() > 0)
        {
            addMoneyEffect(ev, context.uMurderID);
        }

        USpeedUI.Blood.UBloodManager.Instance.OnEntityDead(m_pFSM.entityID, ENTITY_TYPE.TYPE_PLAYER_ROLE);
        // 小地图隐藏
//         U3D_Render.EntityView objev = EntityFactory.getEntityViewByID(m_pFSM.entityID);
//         if (objev != null && GFxMinimapManager.Instance != null)
//         {
//             GFxMinimapManager.Instance.SetObjectVisible(m_pFSM.entityID, objev.createinfo.nMinimapIcon, 0);
//         }
        return(true);
    }
Exemplo n.º 3
0
    // 离开状态
    public void OnLeave()
    {
        if (!m_pFSM)
        {
            return;
        }

        Trace.Log(m_pFSM.name + "=======OnLeave CreaturePosture_Dead======");

        //死亡动作在攻击层调用,这里结束掉死亡动作
        m_pFSM.BreakAttackAnim();

        SkillCtrl sk = m_pFSM.GetComponent <SkillCtrl>();

        if (sk)
        {
            sk.enabled = true;
        }

        if (m_pFSM.isHero) //复活时切回主角镜头
        {
            SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.DeadControl, false);
        }

        SoldierController sco = m_pFSM.GetComponent <SoldierController>();

        if (sco)
        {
            sco.dead        = false;
            sco.desireAngle = m_pFSM.transform.localEulerAngles;
            //sco.bindSoldierCamera.Reset(); 2016-09-22,策划需求,复活后摄像机位置保持原来跟角色的位置,不重置,改为仅取消effect
            CameraEffectUtil.MainInstance.stopEffect();
        }
        if (m_pFSM.isHero)
        {
            //ImageEffects.ImageEffectManager.API_DisableImageEffect<ImageEffects.FullScreenGray>();
            LightingEffectFactory.DisableDeadEffect();
            ImageEffects.ImageEffectManager.API_DisableImageEffect <ImageEffects.FullScreenSaturation>();
            ImageEffects.ImageEffectManager.API_EnableImageEffect <ImageEffects.DepthOfFieldScatter>();
        }


        //恢复死亡不碰撞
        if (m_pFSM.controller)
        {
            m_pFSM.pickableCount++;
            //if (true==m_pFSM.GetVisible())
            //{
            //    m_pFSM.gameObject.layer = m_pFSM.baseLayer;
            //}
        }

        ////实体复活不是重新发下来的,在这里改回原来的层
        //if (!m_pFSM.isHero)
        //{
        //    GameUtil.SetLayer(nOldLayer, m_pFSM.gameObject, true);
        //    //m_pFSM.gameObject.layer = nOldLayer;
        //    //if (m_pFSM.SkinConfig.ScreenCastObject != null)
        //    //{
        //    //    m_pFSM.SkinConfig.ScreenCastObject.layer = nOldLayer;
        //    //}
        //}

        if (m_pFSM.animator)
        {
            Trace.Log("SetTrigger(Reborn)");
            m_pFSM.animator.SetTrigger("Reborn");
            m_pFSM.animator.ResetTrigger("Dead");
            m_pFSM.animator.speed = 1;
        }

        //GfxBloodManager.OnEntityRelive(m_pFSM.entityID, ENTITY_TYPE.TYPE_PLAYER_ROLE);
        USpeedUI.Blood.UBloodManager.Instance.OnEntityRelive(m_pFSM.entityID, ENTITY_TYPE.TYPE_PLAYER_ROLE);
        //TopNameManager.OnEntityRelive(m_pFSM.entityID, ENTITY_TYPE.TYPE_PLAYER_ROLE);

        //某些特效,在模型死亡时,会将模型隐藏起来,复活的时候设置为可见
        m_pFSM.SetVisible(m_pFSM.m_OnViewVisible);

        //         // 小地图显示
        //         U3D_Render.EntityView objev = EntityFactory.getEntityViewByID(m_pFSM.entityID);
        //         if (objev != null)
        //         {
        //             GFxMinimapManager.Instance.SetObjectVisible(m_pFSM.entityID, objev.createinfo.nMinimapIcon, 1);
        //         }
        U3D_Render.EntityView objev = EntityFactory.getPlayerViewByID(m_pFSM.entityID);
        if (objev != null && objev.gameObject != null && objev.Property != null)
        {
            int nHeroID = objev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
            SoundPlayHandler.PlayHeroRandomSound(nHeroID, m_pFSM.entityID, objev.gameObject, ASpeedGame.Data.Scheme.EMHeroSoundType.EHeroSound_Relive);
        }
    }