Ejemplo n.º 1
0
 public void DestroyParticleAnimation(ParticleAnimation ani)
 {
     if (ani != null)
     {
         ani.Destroy();
     }
 }
 private void AssignPAanim(ParticleAnimation pa)
 {
     if (listBox1.SelectedIndex != -1)
     {
         var temp = listBox1.SelectedItem as BasicAbility;
         temp.abilityPAID = pa.particleAnimationID;
         temp.PAanim      = pa.Clone();
     }
 }
Ejemplo n.º 3
0
    //调用create接口 外界需要自行销毁
    public ParticleAnimation CreateParticleAnimation(int id, GameObject parent = null, int w = -1, int h = -1)
    {
        if (!DataManager.UIEffectTable.ContainsKey(id))
        {
            return(null);
        }

        UIEffectTableItem item = DataManager.UIEffectTable[id] as UIEffectTableItem;

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

        GameObject obj = new GameObject(item.particle);

        GameObject.DontDestroyOnLoad(obj);
        if (parent != null)
        {
            obj.transform.parent        = parent.transform;
            obj.transform.localPosition = Vector3.zero;
            obj.transform.localRotation = Quaternion.identity;
            obj.transform.localScale    = Vector3.one;
            obj.layer = parent.layer;
        }
        UISprite sprite = obj.AddMissingComponent <UISprite>();

        if (w == -1)
        {
            sprite.width = item.width;
        }
        else
        {
            sprite.width = w;
        }

        if (h == -1)
        {
            sprite.height = item.height;
        }
        else
        {
            sprite.height = h;
        }

        UIParticlePreview preview = new UIParticlePreview(item.Camerasize);

        preview.SetTargetSprite(sprite, false);
        preview.RotationY = 180;
        preview.SetupParticle(item.particle);

        ParticleAnimation animation = new ParticleAnimation(sprite, preview);

        return(animation);
    }
Ejemplo n.º 4
0
 public void Clear()
 {
     mWingSprite   = null;
     mDaChengState = null;
     if (mWingPicAni != null)
     {
         mWingPicAni.Destroy();
         mWingPicAni = null;
     }
     mDaChengPicList.Clear();
     GameObject.DestroyImmediate(mView);
 }
Ejemplo n.º 5
0
    void playSucessEffect(EggType et)
    {
        int idx = (int)et;

        UISprite eggSpri = mEggs[idx - 1].GetComponent <UISprite>();

        eggSpri.spriteName = EGG_NAMES[(idx - 1) * 2 + 1];
        eggSpri.MakePixelPerfect();

        ParticleAnimation ani = AnimationManager.Instance.PlayParticleAnimation(4, mEggs[idx - 1], 15);

        ani.gameObject.transform.localPosition = new Vector3(ani.gameObject.transform.localPosition.x, ani.gameObject.transform.localPosition.y + 100f, ani.gameObject.transform.localPosition.z);
    }
Ejemplo n.º 6
0
    public void Update()
    {
        IDictionaryEnumerator itr = mParticleAnimations.GetEnumerator();

        while (itr.MoveNext())
        {
            ParticleAnimation item = itr.Value as ParticleAnimation;

            uint key = Convert.ToUInt32(itr.Key);

            //检测特效是否播放完成
            if (item == null || item.IsDead())
            {
                //自然消失的特效放在这里,管理器将其销毁
                if (item != null)
                {
                    mDestroys.Add(key);
                }
            }
            else
            {
                item.OnUpdate();
            }
        }


//         for (int i = 0; i < mParticleAnimations.Keys.Count; ++i )
//         {
//             uint key = mParticleAnimations.Keys.ElementAt(0);
//             if (!mParticleAnimations.ContainsKey(key))
//                 continue;
//
//
//         }

        for (int i = 0; i < mDestroys.Count; ++i)
        {
            uint key = mDestroys[i];

            if (mParticleAnimations.ContainsKey(key))
            {
                ParticleAnimation item = mParticleAnimations[key];

                mParticleAnimations.Remove(key);

                item.Destroy();
            }
        }

        mDestroys.Clear();
    }
Ejemplo n.º 7
0
            private Vector4 StartNewAnimation(Vector4 oldData, bool randomOffset)
            {
                Vector4 data;

                ParticleAnimation anim = PickRandomAnimation();

                AnimationTexture.Animation animation = GetAnimation(anim._animationIndex);

                data.x = anim._animationIndex;
                data.y = randomOffset ? Random.Range(0, animation._totalFrames - 2) : 0;
                data.z = anim._speedRange.GetRandomValue();
                data.w = 1.0f;

                return(data);
            }
Ejemplo n.º 8
0
    public ParticleAnimation PlayParticleAnimation(int id, GameObject parent = null, int depth = 0, int w = -1, int h = -1)
    {
        ParticleAnimation ani = CreateParticleAnimation(id, parent, w, h);

        if (ani == null)
        {
            return(null);
        }
        ani.SetDepth(depth);
        uint insid = msParticleCount++;

        mParticleAnimations.Add(insid, ani);

        return(ani);
    }