Esempio n. 1
0
        //特效创建接口
        public void Create()
        {
            //创建的时候检查特效projectId,服务器没有设置生成本地id
            CheckProjectId();
            //获取特效模板名称
            templateName = ResourceCommon.getResourceName(resPath);

            //使用特效缓存机制
            obj = ObjectPool.Instance.GetGO(resPath);

            if (null == obj)
            {
                Debugger.LogError("load effect object failed in IEffect::Create" + resPath);
                return;
            }

            //创建完成,修改特效名称,便于调试
            obj.name = templateName + "_" + projectID.ToString();

            OnLoadComplete();

            //获取美术特效脚本信息
            effectScript = obj.GetComponent <EffectScript>();
            if (effectScript == null)
            {
                Debugger.LogError("cant not find the effect script in " + resPath);
                return;
            }
            artTime = effectScript.lifeTime;

            //美术配置时间为0,使用策划时间
            if (effectScript.lifeTime == 0)
            {
                lifeTime = cehuaTime;
            }
            //否则使用美术时间
            else
            {
                lifeTime = artTime;
            }

            //特效等级不同,重新设置
            EffectLodLevel effectLevel = effectScript.lodLevel;
            EffectLodLevel curLevel    = EffectManager.Instance.mLodLevel;

            if (effectLevel != curLevel)
            {
                //调整特效显示等级
                AdjustEffectLodLevel(curLevel);
            }
        }
Esempio n. 2
0
        //特效创建接口
        public void Create()
        {
            //创建的时候检查特效projectId,服务器没有设置生成本地id
            CheckProjectId();
            //获取特效模板名称
            templateName = ResourceCommon.getResourceName(resPath);

            //使用特效缓存机制
            obj = GameObjectPool.Instance.GetGO(resPath);

            ////使用特效缓存机制但是无缓存特效或者 不使用缓存特效
            //if ((EffectManager.Instance.CachEffect && obj == null) ||(!EffectManager.Instance.CachEffect))
            //{
            //    //每次重新创建
            //    ResourceUnit unit = ResourcesManager.Instance.loadImmediate(resPath, ResourceType.PREFAB);

            //    if (null == unit.Asset)
            //    {
            //        Debug.LogError("load PREFAB failed in IEffect::Create" + resPath);
            //        return;
            //    }

            //    obj = GameObject.Instantiate(unit.Asset) as GameObject;
            //}

            if (null == obj)
            {
                Debugger.LogError("load effect object failed in IEffect::Create" + resPath);
                return;
            }

            //创建完成,修改特效名称,便于调试
            obj.name = templateName + "_" + projectID.ToString();

            OnLoadComplete();

            //获取美术特效脚本信息
            effectScript = obj.GetComponent <EffectScript>();
            if (effectScript == null)
            {
                Debugger.LogError("cant not find the effect script in " + resPath);
                return;
            }
            artTime = effectScript.lifeTime;

            //美术配置时间为0,使用策划时间
            if (effectScript.lifeTime == 0)
            {
                lifeTime = cehuaTime;
            }
            //否则使用美术时间
            else
            {
                lifeTime = artTime;
            }

            //特效等级不同,重新设置
            EffectLodLevel effectLevel = effectScript.lodLevel;
            EffectLodLevel curLevel    = EffectManager.Instance.mLodLevel;

            if (effectLevel != curLevel)
            {
                //调整特效显示等级
                AdjustEffectLodLevel(curLevel);
            }
        }