Esempio n. 1
0
    IEnumerator CouPreloadModel()
    {
        while (ConfigMng.Instance.Pendings > 0)
        {
            yield return(new WaitForFixedUpdate());
        }
        if (GameCenter.loginMng.createPlayerInfoDic.Count == 0)
        {
            GameCenter.loginMng.InitCreatePlayerInfo();
            foreach (PlayerBaseInfo item in GameCenter.loginMng.createPlayerInfoDic.Values)
            {
                CreatePlayer preloadPlayer = CreatePlayer.CreateDummy(item);
                preloadPlayer.StartAsyncCreate(() =>
                {
                    preloadPlayer.transform.position = new Vector3(-1000, -1000, -1000);
                });

                AbilityInstance ability = new AbilityInstance(item.CreateAbilityID, 1, null, null);
                if (ability != null)
                {
                    string effectName = ability.ProcessEffectList.Count > 0 ? ability.ProcessEffectList[0] : string.Empty;
                    if (!string.IsNullOrEmpty(effectName))
                    {
                        AssetMng.GetEeffctAssetObject(effectName, (x) => { });
                        //AssetMng.GetEffectInstance(effectName, null);//预加载特效
                    }
                }
            }
        }
    }
Esempio n. 2
0
    protected override void Init()
    {
        base.Init();
        animFSM = base.animFSM as SceneItemAnimFSM;
        if (animFSM != null)
        {
            animFSM.SetDeadAnim(actorInfo.DeadAnimName, actorInfo.DeadTime);
            animFSM.SetupIdleAndMoveAnimationName("idle1", "move2");
            animFSM.SetupCombatAnimationName("idle1", null);
            animFSM.Idle();
        }
        nameHeight     = actorInfo.NameHeight;
        height         = 0f;
        beAttackRadius = actorInfo.ColliderRadius;
        //IsActiveForMainplayer = CheckIsActiveForMainplayer();
        if (headTextCtrl == null)
        {
            headTextCtrl = this.gameObject.AddComponent <HeadTextCtrl>();
        }
        if (!actorInfo.IsActor)        // && IsActiveForMainplayer) //过场动画演员不展示名字
        {
            UpdateName();
        }
//        if (actorInfo.BubbleContent != null)
//        {
//            headTextCtrl.SetBubble(actorInfo.BubbleContent.content, actorInfo.BubbleContent.time);
//        }
        AssetMng.GetEeffctAssetObject(actorInfo.DeadEffectName, null);//预加载死亡特效(镜像文件)
        inited_ = true;



        ActiveBoxCollider(IsActiveForMainplayer, actorInfo.colliderScale);
        ShowPointEffect();
    }
Esempio n. 3
0
    /// <summary>
    /// 初始化  全局静态对象池在这个接口中初始化。(如被击特效等根据场景来的对象池就不能在这里初始化) by吴江
    /// </summary>
    /// <param name="_callback"></param>
    /// <returns></returns>
    protected IEnumerator StartInit(System.Action _callback)
    {
        poolObject = new GameObject("Pool Cache");
        poolObject.transform.position = Vector3.zero;
        GameObject.DontDestroyOnLoad(poolObject);

        //////点击地面特效
        int pendings = 0;

        pendings++;
        AssetMng.GetEeffctAssetObject("cursor_b02", (x) =>
        {
            pendings--;
            if (x != null)
            {
                GameObject indicatorPoolCache              = new GameObject("IndicatorPoolCache");
                indicatorPoolCache.transform.parent        = poolObject.transform;
                indicatorPoolCache.transform.localPosition = Vector3.zero;
                indicatorPool.Init(x, 3, indicatorPoolCache.transform);
            }
            else
            {
                Debug.LogError("地面点击特效加载失败!");
            }
        });
        while (pendings > 0)
        {
            yield return(new WaitForFixedUpdate());
        }


        //脚下光圈
        pendings++;
        AssetMng.GetEeffctAssetObject("m_f_005", (x) =>
        {
            pendings--;
            if (x != null)
            {
                GameObject ringEffecterPoolCache              = new GameObject("RingEffecterPoolCache");
                ringEffecterPoolCache.transform.parent        = poolObject.transform;
                ringEffecterPoolCache.transform.localPosition = Vector3.zero;
                ringEffecterPool.Init(x, 1, ringEffecterPoolCache.transform);
            }
            else
            {
                Debug.LogError("光圈特效特效加载失败!");
            }
        });
        while (pendings > 0)
        {
            yield return(new WaitForFixedUpdate());
        }


        //阴影投射器
        //GameObject shadowPoolCache = new GameObject("shadowPoolCache");
        //shadowPoolCache.transform.parent = poolObject.transform;
        //shadowPoolCache.transform.localPosition = Vector3.zero;

        //GameObject prefab = Instantiate(exResources.GetResource(ResourceType.OTHER, "ShadowProjector")) as GameObject;
        //prefab.SetActive(false);
        //shadowEffectorPool.Init(prefab, 5, shadowPoolCache.transform);

        //技能预警投射器
        GameObject abilityShadowPoolCache = new GameObject("abilityShadowPoolCache");

        abilityShadowPoolCache.transform.parent        = poolObject.transform;
        abilityShadowPoolCache.transform.localPosition = Vector3.zero;

        GameObject abilityShadowPrefab = Instantiate(exResources.GetResource(ResourceType.OTHER, "AbilityProjector")) as GameObject;

        abilityShadowPrefab.SetActive(false);
        AbilityShadowEffectorPool.Init(abilityShadowPrefab, 2, abilityShadowPoolCache.transform);


        //漂浮文字
        GameObject stateTexterPoolCache = new GameObject("StateTexterPoolCache");

        stateTexterPoolCache.transform.parent        = GameCenter.cameraMng.uiCamera.transform.root;
        stateTexterPoolCache.transform.localPosition = Vector3.zero;

        GameObject stateTexterPrefab = Instantiate(exResources.GetResource(ResourceType.TEXT, "StateTexter")) as GameObject;
        // UILabel lb = NGUITools.AddWidget<UILabel>(stateTexterPoolCache);
        NumberLookAt lookCtrl = stateTexterPrefab.GetComponent <NumberLookAt>();

        if (lookCtrl == null)
        {
            lookCtrl = stateTexterPrefab.AddComponent <NumberLookAt>();
        }
        lookCtrl.target = GameCenter.cameraMng.mainCamera;
        stateTexterPool.Init(stateTexterPrefab, 0, stateTexterPoolCache.transform);//在不是0的时候  最开始的几下看不到数字 by邓成


        ////弹道
        GameObject ballisticCurvePoolCache = new GameObject("ballisticCurvePoolCache");

        ballisticCurvePoolCache.transform.parent        = poolObject.transform;
        ballisticCurvePoolCache.transform.localPosition = Vector3.zero;

        GameObject ballisticCurveprefab = new GameObject("BallisticCurve");

        ballisticCurveprefab.AddComponent <AbilityBallisticCurve>();
        abilityBallisticCurvePool.Init(ballisticCurveprefab, 3, ballisticCurvePoolCache.transform);

        ////技能延迟对象
        GameObject abilityDelayEffectCtrlPoolCache = new GameObject("abilityDelayEffectCtrlPoolCache");

        abilityDelayEffectCtrlPoolCache.transform.parent        = poolObject.transform;
        abilityDelayEffectCtrlPoolCache.transform.localPosition = Vector3.zero;

        GameObject abilityDelayEffectCtrlprefab = new GameObject("abilityDelayEffectCtrl");

        ballisticCurveprefab.AddComponent <AbilityDelayEffectCtrl>();
        abilityDelayEffectCtrlPool.Init(abilityDelayEffectCtrlprefab, 5, abilityDelayEffectCtrlPoolCache.transform);

        inited = true;
        if (_callback != null)
        {
            _callback();
        }
    }