Ejemplo n.º 1
0
        public GameObject CreateUILayer()
        {
            if (anchorGo == null)
            {
                GameObject uiParentGo = new GameObject("UILayer");
                Object.DontDestroyOnLoad(uiParentGo);
                uiParentGo.AddComponent <UIRoot>();
                UIRoot uiRoot = uiParentGo.GetComponent <UIRoot>();
                uiRoot.scalingStyle  = UIRoot.Scaling.PixelPerfect;
                uiRoot.manualHeight  = 900;
                uiRoot.minimumHeight = 900;
                uiParentGo.layer     = CameraLayerManager.GetInstance().Get2DLayTag();

                anchorGo = new GameObject("anchor");
                anchorGo.AddComponent <UIAnchor>();
                anchorGo.transform.parent = uiParentGo.transform;
                anchorGo.layer            = CameraLayerManager.GetInstance().Get2DLayTag();
            }

            GameObject panelGo = new GameObject("layer");

            panelGo.AddComponent <UIPanel>();
            panelGo.transform.parent = anchorGo.transform;
            panelGo.layer            = CameraLayerManager.GetInstance().Get2DLayTag();

            return(panelGo);
        }
Ejemplo n.º 2
0
        private void LoadResource_OnLoadComplete(AssetInfo info)
        {
            if (this == null && Owner == null)
            {
                return;
            }
            try
            {
                Owner.BodyGo = GameObject.Instantiate(info.bundle.mainAsset) as GameObject;
            }
            catch (System.Exception e)
            {
                //游戏对象已经被释放.
                return;
            }
            Owner.BodyGo.transform.parent        = Owner.transform;
            Owner.BodyGo.transform.localPosition = Vector3.zero;
            Owner.BodyGo.transform.rotation      = Quaternion.identity;
            Owner.BodyGo.transform.localScale    = new Vector3(1, 1, 1);
            Owner.BodyGo.layer = CameraLayerManager.GetInstance().GetSceneObjectTag();
            Owner.Anim         = Owner.BodyGo.animation;
            BoxCollider bc0 = Owner.BodyGo.gameObject.GetComponent <BoxCollider>();

            if (null != bc0)
            {
                bc.size   = bc0.size;
                bc.center = bc0.center;
                GameObject.DestroyObject(bc0);
            }
        }
Ejemplo n.º 3
0
        private void AddLightForAvatar(GameObject role)
        {
            if (hasLight)
            {
                return;
            }
            GameObject lightObj = new GameObject("TheLight");

            lightObj.transform.parent = role.transform;
            lightObj.layer            = LayerMask.NameToLayer("2D");
            Light light = lightObj.AddComponent <Light>();

            light.type                       = LightType.Spot;
            light.range                      = 9.7f;
            light.spotAngle                  = 105;
            light.color                      = Color.white;
            light.intensity                  = 0.7f;
            light.shadows                    = LightShadows.None;
            light.renderMode                 = LightRenderMode.Auto;
            light.cullingMask                = CameraLayerManager.GetInstance().Get2DTag();
            light.transform.localPosition    = new Vector3(-83.46f, 232.51f, 45.33f);
            light.transform.localEulerAngles = new Vector3(41.43f, 125f, 331.77f);
            light.transform.localScale       = Vector3.one;
            //light.transform.parent = role.transform;

            lightObj = new GameObject("TheLight");
            lightObj.transform.parent = role.transform;
            lightObj.layer            = LayerMask.NameToLayer("2D");
            light                            = lightObj.AddComponent <Light>();
            light.type                       = LightType.Spot;
            light.range                      = 24.37f;
            light.spotAngle                  = 41;
            light.color                      = new Color(253f / 255, 255f / 255, 255f / 255, 255f / 255);
            light.intensity                  = 0.7f;
            light.shadows                    = LightShadows.None;
            light.renderMode                 = LightRenderMode.Auto;
            light.cullingMask                = CameraLayerManager.GetInstance().Get2DTag();
            light.transform.localPosition    = new Vector3(119f, 15.141f, 102.04f);
            light.transform.localEulerAngles = new Vector3(340.69f, 228.50f, 22.41f);
            light.transform.localScale       = Vector3.one;
            //light.transform.parent = role.transform;

            lightObj = new GameObject("TheLight");
            lightObj.transform.parent = role.transform;
            lightObj.layer            = LayerMask.NameToLayer("2D");
            light                            = lightObj.AddComponent <Light>();
            light.type                       = LightType.Point;
            light.range                      = 7.7f;
            light.color                      = new Color(14f / 255, 195f / 255, 231f / 255, 255f / 255);
            light.intensity                  = 0.7f;
            light.shadows                    = LightShadows.None;
            light.renderMode                 = LightRenderMode.Auto;
            light.cullingMask                = CameraLayerManager.GetInstance().Get2DTag();
            light.transform.localPosition    = new Vector3(10f, 68.45f, -91.37f);
            light.transform.localEulerAngles = new Vector3(9.61f, 186.16f, 330.63f);
            light.transform.localScale       = Vector3.one;
            //light.transform.parent = role.transform;
            hasLight = true;
        }
Ejemplo n.º 4
0
    private void InitCoreManager()
    {
        RegisterLog();
        DontDestroyOnLoad(this.gameObject);
        log.Debug("Start game application...");
        GameWorld.GetInstance();
        LoggerView.GetInstance();
        CameraLayerManager.GetInstance();
        AssetLoader.GetInstance();
        ViewCameraManager.GetInstance().Init();
        LayerManager.GetInstance().Init();
        RemoteCallLogic.GetInstance();
        NGUIManager.GetInstance();

        LoginController.GetInstance();
        SceneLogic.GetInstance();
        PlayerController.GetInstance();
        BagLogic.GetInstance();
        NpcLogic.GetInstance();
        TimeManager.GetInstance();
        ViewManager.GetInstance();
        gameObject.AddComponent("CronJob");
        LoadResource();

        //ActiveRush.InitFx();



        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao03_xuanfengzhan_g2"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao01_lipihuashantexiao"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao03_xuanfengzhan"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao03_xuanfengzhan_mingzhong2"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao_mingzhong"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao_mingzhong_g"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao_wuqifeixing"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao04_yuanyuewandao"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_badao02_nuzhanbahuang_gongji"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_06_nuhou_shifa"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_05_zhenfei"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_04_chongfeng"));
        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_skill_daobin_04_chongfeng_mingzhong"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_guaiwusiwang2"));

        AssetLoader.GetInstance().PreLoad(URLUtil.GetEffectPath("effect_levelup"));

        AssetLoader.GetInstance().Load(URLUtil.GetEffectPath("effect_guangquan_yellow"), PLAYER_SEL_LoadComplete, AssetType.BUNDLER);
        AssetLoader.GetInstance().Load(URLUtil.GetEffectPath("effect_guangquan2_red"), NPC_SEL_LoadComplete, AssetType.BUNDLER);

        PreLoad.GetInstance().OnEnterScene();
        SelecterManager.GetInstance();
    }
Ejemplo n.º 5
0
 private void Sign_LoadComplete(AssetInfo info)
 {
     if (missionSign == null)
     {
         missionSign = GameObject.Instantiate(info.bundle.mainAsset) as GameObject;
         missionSign.transform.parent        = Owner.BodyGo.transform;
         missionSign.transform.localPosition = new Vector3(0, 3, 0);
         missionSign.transform.localScale    = Vector3.one;
         ObjectUtil.SetTagWithAllChildren(missionSign, CameraLayerManager.GetInstance().GetMissionSignName());
     }
 }
Ejemplo n.º 6
0
        private void CreateCamera()
        {
            GameObject go = new GameObject(parent.name + "Camera");

            camera = go.AddComponent <Camera>();
            camera.orthographicSize        = 100;
            camera.depth                   = 4;
            camera.clearFlags              = CameraClearFlags.SolidColor;
            camera.cullingMask             = CameraLayerManager.GetInstance().Get3DUITag();
            camera.targetTexture           = renderTexture;
            camera.transform.localPosition = position;
        }
Ejemplo n.º 7
0
        public static UILabel AddUILabel(GameObject parentGo)
        {
            GameObject go = new GameObject("UILabel");

            go.transform.parent = parentGo.transform;
            go.layer            =
                go.layer        = CameraLayerManager.GetInstance().Get2DLayTag();
            UILabel label = go.AddComponent <UILabel>();
            float   s     = 0.002857143f * 100;

            go.transform.localScale    = new Vector3(s, s, s);
            go.transform.localPosition = Vector3.zero;
            label.font = FontManager.GetInstance().Font;
            return(label);
        }
Ejemplo n.º 8
0
        private void LoadResource_OnLoadComplete(AssetInfo info)
        {
            if (this == null && Owner == null)
            {
                return;
            }
            try
            {
                Owner.BodyGo = GameObject.Instantiate(info.bundle.mainAsset) as GameObject;
            }
            catch (System.Exception e)
            {
                //对象月已经释放.
                return;
            }

            Owner.BodyGo.transform.parent        = Owner.transform;
            Owner.BodyGo.transform.localPosition = Vector3.zero;
            Owner.BodyGo.transform.rotation      = Quaternion.identity;
            Owner.BodyGo.transform.localScale    = new Vector3(1, 1, 1);
            Owner.BodyGo.layer = CameraLayerManager.GetInstance().GetSceneObjectTag();
            Owner.Anim         = Owner.BodyGo.animation;
            BoxCollider _boxCollider = Owner.BodyGo.GetComponent <BoxCollider>();

            if (null == _boxCollider)
            {
                Vector3 _size = KingSoftCommonFunction.GetGameObjectSize(Owner.BodyGo);
                float   _h    = _size.y / Owner.transform.localScale.y;
                float   _s    = Mathf.Max(_size.x, _size.z) * 0.5f / Owner.transform.localScale.y;
                Owner.property.characterController.size   = new Vector3(_s, _h, _s);
                Owner.property.characterController.center = new Vector3(0, _h / 2, 0);
            }
            else
            {
                Owner.property.characterController.size   = _boxCollider.size * Owner.BodyGo.transform.localScale.y;
                Owner.property.characterController.center = _boxCollider.center * Owner.BodyGo.transform.localScale.y;
                GameObject.Destroy(_boxCollider);
            }
            if (Owner.L_Anim_Name.Length > 0)
            {
                Owner.DispatchEvent(ControllerCommand.PlayAnimation, Owner.L_Anim_Name, Owner.AnimModel);
            }
            if (Owner.ActiveAction.NAME.CompareTo("ActionMousterOut") == 0)
            {
                Owner.BodyGo.transform.localPosition = Vector3.down * 3f;
            }
            Owner.DispatchEvent(ControllerCommand.UPDATE_MISSION_SIGN);
        }
Ejemplo n.º 9
0
 public void PlayEndFx(float second)
 {
     if (displayInfor.EndEffect.Length > 0)
     {
         AssetInfo inf = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + displayInfor.EndEffect);
         if (inf.isDone(false))
         {
             EndFxObj = inf.CloneGameObject();
             EndFxObj.transform.parent        = hero.transform;
             EndFxObj.transform.localPosition = Vector3.zero;
             ObjectUtil.SetTagWithAllChildren(EndFxObj, CameraLayerManager.GetInstance().GetMissionSignName());
             if (displayInfor.EndEffectBindPoint.Length == 0 || displayInfor.BeginEffectBindPoint.CompareTo("Ground") == 0)
             {
                 EndFxObj.transform.localRotation = Quaternion.identity;
                 EndFxObj.transform.localScale    = Vector3.one;
             }
             else
             {
                 Transform t = hero.GetChildTransform(displayInfor.BeginEffectBindPoint);
                 if (null != t)
                 {
                     EndFxObj.transform.parent        = t;
                     EndFxObj.transform.localPosition = Vector3.zero;
                     EndFxObj.transform.localRotation = Quaternion.identity;
                     EndFxObj.transform.localScale    = Vector3.one;
                     EndFxObj.transform.parent        = hero.transform;
                 }
             }
             if (!displayInfor.EndEffectBind)
             {
                 EndFxObj.transform.parent = hero.transform.parent;
             }
             ParticleSystemScaleManager.ScaleParticle(EndFxObj);
             KingSoftCommonFunction.SetLayer(EndFxObj, 11);
             EndFxObj.SetActive(true);
             DestoryObject dos = EndFxObj.AddComponent <DestoryObject>();
             dos.delta = second;
         }
     }
     if (hitTicker.isPlaying())
     {
         OnHit();
     }
 }
Ejemplo n.º 10
0
        public object OnAddBuff(params object[] objs)
        {
            ushort wBuffID = Convert.ToUInt16(objs[0]);

            InitBuff(wBuffID);
            BuffInfor infor;
            FxAsset   assert;

            OnRemoveBuff(wBuffID);
            if (globalBuffsTemps.TryGetValue(wBuffID, out infor))
            {
                if (infor.infor.AttributeKey1.CompareTo("atForbitMove") == 0)
                {
                    Owner.property.lockOpera = true;
                }
                assert = infor.assert;
                int       len  = infor.bindPoints.Length;
                SkillBuff buff = new SkillBuff();

                buffs[wBuffID] = buff;
                buff.wBuffID   = wBuffID;
                buff.infor     = infor.infor;
                buff.buffs     = new GameObject[len];
                for (int i = 0; i < len; i++)
                {
                    GameObject g = assert.CloneAndAddToParent(Owner.transform, Vector3.up * 1.5f);
                    if (null == g)
                    {
                        return(null);
                    }
                    buff.buffs[i] = g;
                    ObjectUtil.SetTagWithAllChildren(g, CameraLayerManager.GetInstance().GetMissionSignName());
                    Transform t = Owner.GetChildTransform(infor.bindPoints[i]);
                    if (null != t)
                    {
                        g.transform.parent = t;
                    }
                    g.transform.localPosition = Vector3.zero;
                    g.transform.localScale    = Vector3.one;
                }
            }
            return(null);
        }
Ejemplo n.º 11
0
        public SceneEntity CreateSceneObject(uint id, KSceneObjectType type, KHeroObjectType heroType, KDoodadType doodadType, Vector3 pos, ulong OwnerID)
        {
            log.Assert(type > (int)KSceneObjectType.sotInvalid);
            log.Assert(id != ConfigManager.INVALID_ID);
            SceneEntity obj = null;

            string soName = type.ToString() + "_" + id.ToString() + "(" + heroType.ToString() + ")";

            obj                        = SceneEntity.Create(soName);
            obj.Position               = pos;
            obj.property.Id            = id;
            obj.OwnerID                = OwnerID;
            obj.property.sceneObjType  = type;
            obj.property.heroObjType   = heroType;
            obj.property.doodadObjType = doodadType;

            allObjectsMap[obj.property.Id] = obj;
            obj.enabled          = true;
            obj.gameObject.layer = CameraLayerManager.GetInstance().GetSceneObjectTag();
            return(obj);
        }
Ejemplo n.º 12
0
 private void LoadResource_OnLoadComplete(AssetInfo info)
 {
     if (this == null && Owner == null)
     {
         return;
     }
     try
     {
         Owner.BodyGo = GameObject.Instantiate(info.bundle.mainAsset) as GameObject;
     }
     catch (System.Exception e)
     {
         //游戏对象已经被释放.
         return;
     }
     Owner.BodyGo.transform.parent        = Owner.transform;
     Owner.BodyGo.transform.localPosition = Vector3.zero;
     Owner.BodyGo.transform.rotation      = Quaternion.identity;
     Owner.BodyGo.transform.localScale    = new Vector3(1, 1, 1);
     Owner.BodyGo.layer = CameraLayerManager.GetInstance().GetSceneObjectTag();
     Owner.Anim         = Owner.BodyGo.animation;
     Owner.name        += Owner.collectInfo.strName;
 }
Ejemplo n.º 13
0
        private void InitObject(GameObject obj, GameObjectAsset asset)
        {
            GameObject go = GameObject.Instantiate(obj) as GameObject;

            go.transform.position   = asset.pos;
            go.transform.rotation   = asset.rotation;
            go.transform.localScale = asset.scale;
            if (go.renderer != null)
            {
                go.transform.parent = sceneParent.transform;
                go.AddComponent <MeshCollider>();
                go.renderer.lightmapIndex        = asset.lightmapIndex;
                go.renderer.lightmapTilingOffset = asset.lightmapTilingOffset;
            }
            if (go.animation != null)
            {
                go.transform.parent = sceneParent.transform;
            }
            if (go.name.IndexOf("PlayerLight_") >= 0)
            {
                SceneLight = go;
                go.transform.localPosition = new Vector3(0, asset.pos.y, 0);
                go.transform.localRotation = UnityEngine.Quaternion.identity;
                go.transform.localScale    = UnityEngine.Vector3.one;
                if (go.transform.localPosition.y < 2 || go.transform.localPosition.y > 10)
                {
                    go.transform.localPosition = new Vector3(0, 6, 0);
                }
                go.light.cullingMask = CameraLayerManager.GetInstance().GetSceneObjectLightCullingMask();
                SceneView.GetInstance().SetSceneLight();
            }
            if (go.name.IndexOf("SunLight_") >= 0)
            {
                go.light.cullingMask = CameraLayerManager.GetInstance().GetSceneObjectSunLightCullingMask();
                go.transform.parent  = sceneParent.transform;
            }
        }
Ejemplo n.º 14
0
        protected void SetGlowImpl(bool isGlow)
        {
            if (!Owner.property.isInteractive)
            {
                return;
            }
            if (null == Owner.property.bodyGo)
            {
                return;
            }
            if (isGlow)
            {
                if (Owner.property.saveMaterialMap.Count == 0)
                {
                    foreach (Renderer render in Owner.property.bodyGo.GetComponentsInChildren <Renderer>())
                    {
                        int        _len    = render.materials.Length;
                        Material[] newMats = new Material[_len];
                        if (render.gameObject.tag.CompareTo(CameraLayerManager.GetInstance().GetMissionSignName()) == 0 ||
                            render.gameObject.layer == 11
                            )
                        {
                            continue;
                        }
                        for (int i = 0; i < _len; i++)
                        {
                            Material oldMaterial = render.materials[i];
                            oldMaterial.SetColor("_Emission", new Color32(0, 0, 0, 0));
                            if (!oldMaterial.HasProperty("_MainTex"))
                            {
                                continue;
                            }

                            Material staticMaterial = null;
                            if (glow_material_pool.Count > 0)
                            {
                                staticMaterial       = glow_material_pool[0];
                                staticMaterial.color = Owner.property.selectMainColor;
                                staticMaterial.SetColor("_RimColor", Owner.property.rimColor);
                                staticMaterial.SetFloat("_RimPower", Owner.property.rimPower);
                                //staticMaterial.SetColor("_Emission",new Color32(0,0,0,0));
                                glow_material_pool.RemoveAt(0);
                            }
                            else
                            {
                                Owner.property.SelectShaderName = glowMaterial.shader.name;
                                staticMaterial = new Material(glowMaterial.shader);
                                //staticMaterial = new Material(Shader.Find(SelectShaderName));
                                staticMaterial.color = Owner.property.selectMainColor;
                                staticMaterial.SetFloat("_RimPower", Owner.property.rimPower);
                                staticMaterial.SetColor("_RimColor", Owner.property.rimColor);
                                staticMaterial.SetColor("_Emission", new Color32(0, 0, 0, 0));
                            }
                            staticMaterial.mainTexture = oldMaterial.mainTexture;
                            newMats[i] = staticMaterial;
                        }
                        Owner.property.saveMaterialMap[render] = render.materials;
                        render.materials = newMats;
                        if (_len == 1)
                        {
                            render.material = newMats[0];
                        }
                    }
                }
            }
            else
            {
                if (Owner.property.saveMaterialMap.Count > 0)
                {
                    foreach (Renderer renderer in Owner.property.saveMaterialMap.Keys)
                    {
                        if (renderer == null)
                        {
                            continue;
                        }
                        foreach (Material mat in renderer.materials)
                        {
                            if (mat.shader.name.CompareTo(Owner.property.SelectShaderName) == 0)
                            {
                                glow_material_pool.Add(mat);
                            }
                        }
                        renderer.materials = Owner.property.saveMaterialMap[renderer];
                    }
                    Owner.property.saveMaterialMap.Clear();
                }
            }
        }
Ejemplo n.º 15
0
        //播放战斗效果
        public void PlayFightEffect(ushort wSkillID, int damage, byte byAttackEvent, SceneEntity killerHero)
        {
            if (byAttackEvent == (byte)KAttackEvent.aeMiss)
            {
                if (Owner.property.isMainHero)
                {
                    Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "2", "FightFont", "effect_ui_shuzitanchu_putong.res");
                }
                else
                {
                    Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "1", "FightFont", "effect_ui_shuzitanchu_putong.res");
                }
                return;
            }
            else if (byAttackEvent == (byte)KAttackEvent.aeCrit)
            {
                Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "CritFont", "effect_ui_shuzitanchu_baoji2.res");
            }
            else if (Owner.property.isMainHero)
            {
                Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "HurtFont", "effect_ui_shuzitanchu_putong.res", NumTip.OFFSET_TYPE.LEFT);
            }
            else
            {
                Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "AttackFont", "effect_ui_shuzitanchu_putong.res");
            }
            KSkillDisplay skillDisplay = KConfigFileManager.GetInstance().GetSkillDisplay(wSkillID, Owner.TabID);

            if (skillDisplay.OnHitAction.CompareTo("JUMP") == 0)
            {
                ActionBeAttactedAndThrowUp action = new ActionBeAttactedAndThrowUp(Owner);
                action.hitAnim     = skillDisplay.OnHitAnim;
                action.time        = skillDisplay.OnHitEffecTime;
                action.height      = skillDisplay.OnHitHeight;
                Owner.ActiveAction = action;
                //action
            }
            else if (Owner.property.heroObjType == KHeroObjectType.hotMonster && Owner.heroSetting.MonsterGrade == KMonsterGrade.mgQuestBoss)
            {
                if (Owner.property.activeAction.TryFinish())
                {
                    ActiionBeAttack beAttack = new ActiionBeAttack(Owner);
                    Owner.DispatchEvent(ControllerCommand.SetActiveAction, beAttack);
                }
            }
            else
            {
                Owner.DispatchEvent(ControllerCommand.BE_HIT);
            }

            Vector3 forward = Vector3.forward;

            if (null != killerHero)
            {
                forward = killerHero.transform.position - Owner.transform.position;
                forward = new Vector3(forward.x, 0, forward.z);
                forward.Normalize();
            }
            if (skillDisplay.HitShakeTime > 0 && skillDisplay.HitShakeDelta > 0)
            {
                Owner.DispatchEvent(ControllerCommand.HIT_SLOW, skillDisplay.HitShakeTime, skillDisplay.HitShakeDelta);
            }

            if (null != skillDisplay && skillDisplay.HitEffect.Length > 0 /*&& skillDisplay.BulletEffect.Length == 0*/)
            {
                AssetInfo inf = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + skillDisplay.HitEffect);
                if (inf.isDone(false))
                {
                    if (skillDisplay.SingleHitFx)
                    {
                        GameObject _hit = null;
                        if (hitFxs.TryGetValue(skillDisplay.HitEffect, out _hit))
                        {
                            GameObject.Destroy(_hit);
                        }
                    }
                    GameObject hitObject = inf.CloneGameObject();
                    ObjectUtil.SetTagWithAllChildren(hitObject, CameraLayerManager.GetInstance().GetMissionSignName());
                    hitObject.transform.parent   = Owner.transform.parent;
                    hitObject.transform.position = Owner.transform.position;
                    hitObject.transform.forward  = forward;
                    if (skillDisplay.SingleHitFx)
                    {
                        hitFxs[skillDisplay.HitEffect] = hitObject;
                    }
                    KingSoftCommonFunction.SetLayer(hitObject, 11);
                    DestoryObject dos = hitObject.AddComponent <DestoryObject>();
                    dos.delta = 5;
                    if (skillDisplay.HitBindPoint.Length > 0)
                    {
                        if (skillDisplay.HitBindPoint.CompareTo("Ground") != 0)
                        {
                            Transform t = Owner.GetChildTransform(skillDisplay.HitBindPoint);
                            if (null != t)
                            {
                                hitObject.transform.parent        = t;
                                hitObject.transform.localPosition = Vector3.zero;
                                hitObject.transform.localScale    = Vector3.one;
                            }
                        }
                    }
                    hitObject.SetActive(true);
                }
            }
        }
Ejemplo n.º 16
0
        /**
         * 检查角色配件是否加载完
         * */
        private void CheckModelIsLoaded()
        {
            if (newRoleType)
            {
                try
                {
                    GameObject.Destroy(Owner.BodyGo);
                    Owner.BodyGo = generator.Generate();
                }
                catch (System.Exception e)
                {
                    //游戏对象已经被释放.
                    return;
                }
                Owner.BodyGo.transform.parent        = Owner.transform;
                Owner.BodyGo.transform.localPosition = Vector3.zero;
                Owner.BodyGo.transform.localScale    = new Vector3(0.01f, 0.01f, 0.01f);
                Owner.BodyGo.transform.rotation      = Quaternion.identity;
                Owner.BodyGo.layer = CameraLayerManager.GetInstance().GetSceneObjectTag();
                BoxCollider _boxCollider = Owner.BodyGo.GetComponent <BoxCollider>();
                if (null != _boxCollider)
                {
                    Owner.property.characterController.size   = _boxCollider.size * Owner.BodyGo.transform.localScale.y;
                    Owner.property.characterController.center = _boxCollider.center * Owner.BodyGo.transform.localScale.y;
                    GameObject.Destroy(_boxCollider);
                }

                Owner.Anim = Owner.BodyGo.GetComponent <Animation>();
                Owner.DispatchEvent(ControllerCommand.PlayAnimation, Owner.L_Anim_Name, Owner.AnimModel);
                newRoleType = false;
            }
            else
            {
                Owner.BodyGo = generator.Generate(Owner.BodyGo);
            }
            foreach (Renderer render in Owner.BodyGo.GetComponentsInChildren <Renderer>())
            {
                int        _len    = render.materials.Length;
                Material[] newMats = new Material[_len];
                if (render.gameObject.tag.CompareTo(CameraLayerManager.GetInstance().GetMissionSignName()) == 0)
                {
                    continue;
                }
                for (int i = 0; i < _len; i++)
                {
                    Material oldMaterial = render.materials[i];
                    oldMaterial.SetColor("_Emission", new Color32(0, 0, 0, 0));
                }
            }
            if (SceneLogic.GetInstance().backgroundType == 1)
            {
                //foreach (Material m in Owner.BodyGo.renderer.materials)
                //{
                //    m.color = new Color32(255, 255, 255, 255);
                //}
            }
            else
            {
                //foreach (Material m in Owner.BodyGo.renderer.materials)
                //{
                //    m.color = new Color32(255, 255, 255, 255);
                //}
            }
            if (!Owner.AnimCmp.pause)
            {
                if (Owner.property.isDeadTemp)
                {
                    Owner.DispatchEvent(ControllerCommand.CrossFadeAnimation, "dead");
                }
                else
                {
                    Owner.DispatchEvent(ControllerCommand.CrossFadeAnimation, "idle1");
                }
            }

            generator.LoadConfigComplete -= CheckModelIsLoaded;
            if (Owner.OwnerID == PlayerManager.GetInstance().MajorPlayer.PlayerID)
            {
                EventDispatcher.GameWorld.Dispath(ControllerCommand.UPDATE_ROLE_AVATAR, new object());
            }
        }