Example #1
0
 public GPUAnimGroup(GPUAnimation o)
 {
     this.prefab   = o._gameObject;
     this.mesh     = o.mesh;
     this.material = o.material;
     this.animCfg  = o.animCfg;
     GPUAnimUtility.Instance.SetupMesh(mesh);
 }
Example #2
0
 public void SetupAnimInfo(Material mat, GPUAnimCfg animCfg)
 {
     if (materials.Contains(mat))
     {
         return;
     }
     if (animCfg)
     {
         for (int i = 0; i < animCfg.AnimClips.Count; i++)
         {
             animInfo[i].x = animCfg.AnimClips[i].animLength;
             animInfo[i].y = animCfg.AnimClips[i].startFrame;
             animInfo[i].z = animCfg.AnimClips[i].frameCount;
             animInfo[i].w = 0;
         }
         mat.SetVectorArray("_AnimInfo", animInfo);  //store anim information to material
         mat.SetFloat("_Speed", 1);
         materials.Add(mat);
     }
 }
 public override void OnInspectorGUI()
 {
     go = (GPUAnimation)target;
     base.OnInspectorGUI();
     if (GUILayout.Button("Play Next: " + clip))
     {
         if (cfg == null)
         {
             cfg = go.animCfg;
         }
         if (Idx >= cfg.AnimClips.Count - 1)
         {
             Idx = 0;
         }
         if (clip != null)
         {
             go.Play(clip);
         }
         clip = cfg.AnimClips[Idx++].clipName;
     }
 }