예제 #1
0
        protected AnimationState GetAnimationStateByName(string animationName)
        {
            if (null == _AnimationUnitComp)
            {
                return(null);
            }
            if (null != _AnimationComp[animationName])
            {
                return(_AnimationComp[animationName]);
            }
            if (null == _AnimationInfo)
            {
                return(null);
            }

            string path = GetFullAssetPath(animationName);

            if (string.IsNullOrEmpty(path))
            {
                //HobaDebuger.Log("cant find animationPath and transform name  is "+ this.transform.name +" animationName is "+ animationName);
                return(null);
            }
            AnimationClip clip = CAssetBundleManager.SyncLoadAssetFromBundle <AnimationClip>(path, "animations", true);

            if (null == clip)
            {
                HobaDebuger.Log("cant Sync Load clip Resource and transform name  is " + this.transform.name + " animationName is " + animationName);
                return(null);
            }

            _AnimationComp.AddClip(clip, animationName);
            return(_AnimationComp[animationName]);
        }
예제 #2
0
        protected AnimationState GetAnimationStateByName(string animationName, bool aysn = true)
        {
            if (null == _AnimationComponent)
            {
                return(null);
            }
            var anim = _AnimationComponent[animationName];

            if (null != anim)
            {
                return(anim);
            }
            if (!aysn || null == _AnimationInfo)
            {
                return(null);
            }

            var path = GetFullAssetPath(animationName);

            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }

            var clip = CAssetBundleManager.SyncLoadAssetFromBundle <AnimationClip>(path, "animations", true);

            if (null == clip)
            {
                return(null);
            }

            _AnimationComponent.AddClip(clip, animationName);
            return(_AnimationComponent[animationName]);
        }
예제 #3
0
    private void CreateDefault()
    {
        var parentTrans = GetTransformParent();

        if (parentTrans == null)
        {
            return;
        }

        var prefab = CAssetBundleManager.SyncLoadAssetFromBundle <GameObject>(path);

        if (prefab == null)
        {
            return;
        }

        var go = CUnityUtil.Instantiate(prefab) as GameObject;

        if (go != null)
        {
            go.name = EntityId;
            var goT = go.transform;
            if (clientPath != string.Empty)
            {
                GameObject goParent = GameObject.Find(clientPath);
                if (goParent)
                {
                    goT.parent = goParent.transform;
                }
                goT.localPosition = position;
                goT.localRotation = Quaternion.Euler(rotation);
            }
            else
            {
                goT.parent   = parentTrans;
                goT.position = position;
                goT.rotation = Quaternion.Euler(rotation);
            }

            Util.SetLayerRecursively(go, LAYER_CG);
            SetTransform(goT);

            if (type == EntityType.Sfx)
            {
                go.SetActive(false);
            }
        }
    }
예제 #4
0
    public void InitGroundEffect()
    {
        //ground effect
        _GroundShadow = _GroundT.Find("Shadow");
        _GroundWater  = _GroundT.Find("Water");

        if (GroundType == GROUND_TYPE.Shadow && _GroundShadow == null)
        {
            if (pbShadow == null)
            {
                //GameObject obj =CAssetBundleManager.SyncLoadAssetFromBundle<GameObject>(ShadowPath, ShadowBundlePath);
                //(ShadowPath, OnShadowLoaded, ShadowBundlePath);
                OnPBLoaded(pbShadow, ref _GroundShadow, GROUND_TYPE.Shadow);
            }
            else
            {
                OnPBLoaded(pbShadow, ref _GroundShadow, GROUND_TYPE.Shadow);
            }
        }
        else if (GroundType == GROUND_TYPE.Water && _GroundWater == null)
        {
            if (pbWater == null)
            {
                //CAssetBundleManager.SyncLoadAssetFromBundle(WaterPath, OnWaterLoaded, WaterBundlePath);
                pbWater = CAssetBundleManager.SyncLoadAssetFromBundle <GameObject>(WaterPath, WaterBundlePath);
                OnPBLoaded(pbWater, ref _GroundWater, GROUND_TYPE.Water);
            }
            else
            {
                OnPBLoaded(pbWater, ref _GroundWater, GROUND_TYPE.Water);
            }
        }

        if (_GroundWater != null)
        {
            _GroundWater.gameObject.SetActive(GroundType == GROUND_TYPE.Water);
        }
        if (_GroundShadow != null)
        {
            _GroundShadow.gameObject.SetActive(GroundType == GROUND_TYPE.Shadow);
        }
    }