Exemple #1
0
 //ha_ani_tool.hadata.puppetdata selectdata;
 void onSelectFile(string filename)
 {
     filesPuppetAnim.Clear();
     filesPuppetAnimFail.Clear();
     foreach (var ani in MeshGroupMgr.mapGroupGroup[filename].data.GetAllAniname())
     {
         if (MeshGroupMgr.GetMeshGroup(filename, ani) != null)
         {
             filesPuppetAnim.Add(ani);
         }
         else
         {
             filesPuppetAnimFail.Add(ani);
         }
     }
 }
Exemple #2
0
    public void updateMesh()
    {
        //Debug.Log("pdata:" + puppetfile + "kcoll"+KAniUseController);
        group = MeshGroupMgr.GetMeshGroup(puppetfile, defaultanim);
        namemap.Clear();
        if (KAniUseController)
        {
            anicontroller = null;

            InitKAni();
            string _name = this.defaultanim;
            if (System.IO.Path.DirectorySeparatorChar == '/')
            {
                _name = _name.Replace('\\', '/');
            }
            _name = System.IO.Path.GetFileNameWithoutExtension(_name);
            _name = System.IO.Path.GetFileNameWithoutExtension(_name).ToLower();
            //Debug.Log("ani:" + _name);
            anicontroller.State(GetKAnim(_name).GetElement(null));
        }
        updateAnim(0);

        //Debug.Log("Com_Sprite::updateMesh(" + (group != null) + ")");
    }
Exemple #3
0
    public void updateAnim(float delta)
    {
        if (anicontroller != null)
        {
            anicontroller.AdvTime(delta);
            //Debug.Log("aniname"+anicontroller.GetFrame().aniname);
            group = MeshGroupMgr.GetMeshGroup(puppetfile, anicontroller.GetFrame().aniname);

            int nframe = anicontroller.GetFrame().frameid;
            var frame  = group.GetFrame(nframe);
            this.GetComponent <MeshFilter>().mesh = frame.mesh;
            var mats = frame.mats.ToArray();
            this.GetComponent <MeshRenderer>().materials = mats;
            if (useColorBlend)
            {
                foreach (var m in mats)
                {
                    if (useWhiteBlend)
                    {
                        if (m.shader.name != "clgc/nolit_gray")
                        {
                            m.shader = Shader.Find("clgc/nolit_gray");
                        }
                        m.SetFloat("Gray", 0);
                        m.SetFloat("White", blendWhite);
                    }
                    else
                    {
                        if (m.shader.name == "clgc/nolit_gray")
                        {
                            m.shader = Shader.Find("clgc/nolit");
                        }
                    }
                    m.color = colorBlend;//("Main Color", colorBlend);
                }
            }
            if (KAniGenColl)
            {
                //生成碰撞体
                GenKAniColl();
            }
            if (KAniSound)
            {
                PlayKAniSound();
            }
        }
        else
        {
            //Debug.Log("Com_Sprite::updateAnim(" + (group != null) + ")");
            if (group == null)
            {
                return;
            }
            //
            //动画帧更新

            timer += delta;
            int nframe = (int)(timer * 30);
            while (nframe > group.maxFrame)
            {
                nframe -= (group.maxFrame + 1);
                timer   = 0;
            }
            var frame = group.GetFrame(nframe);

            this.GetComponent <MeshFilter>().mesh = frame.mesh;
            var mats = frame.mats.ToArray();
            this.GetComponent <MeshRenderer>().materials = mats;
            if (useColorBlend)
            {
                foreach (var m in mats)
                {
                    m.color = colorBlend;//("Main Color", colorBlend);
                }
            }
        }
    }