예제 #1
0
    public static void Show(FB.PosePlus.AniPlayer aniPlayer = null, AniClip clip = null, int curfunc = -1, int curframe = -1)
    {
        var window = EditorWindow.GetWindow <Window_StateBlockFuncs>(false, "Block详细编辑");

        window.Init();
        if (clip != null)
        {
            _clip    = Window_StateTable.aniPlayer.GetClip(Window_StateTable.selectBlock.playani);
            _subclip = clip.GetSubClip(Window_StateTable.selectBlock.playsubani);
            Debug.Log(Window_StateTable.selectBlock.playani);
        }
        else
        {
            _clip    = clip;
            _subclip = clip.GetSubClip(Window_StateTable.selectBlock.playsubani);
        }
        if (curframe >= 0)
        {
            selectFrame = curframe;
        }
        if (curfunc >= 0)
        {
            SelectSelectFunc(Window_StateTable.selectBlock.funcs[curfunc]);
        }
        else
        {
            SelectSelectFunc(null);
        }
        clip = Window_StateTable.aniPlayer.GetClip(Window_StateTable.selectBlock.playani);
        if (clip != null)
        {
            _subclip = clip.GetSubClip(Window_StateTable.selectBlock.playsubani);
        }
        if (curfunc >= 0 && curfunc <= Window_StateTable.selectBlock.funcs.Count - 1)
        {
            SelectSelectFunc(Window_StateTable.selectBlock.funcs[curfunc]);
        }
        if (aniPlayer != null)
        {
            _aniPlayer = aniPlayer;
        }


        pickfunc = null;
    }
예제 #2
0
 void ParseBlock(StateActionBlock block, AI_StateItem ai_item, AI_StateAttribute ai_attribute)
 {
     foreach (var f in block.funcs)
     {
         if (f.classname.Equals("attack"))
         {
             AniClip ac    = ap.GetClip(block.playani);
             SubClip subAc = null;
             if (block.playsubani != "" && block.playsubani != null)
             {
                 subAc = ac.GetSubClip(block.playsubani);
             }
             int begin = 0;
             int end   = 0;
             if (subAc != null)
             {
                 begin = (int)subAc.startframe;
                 end   = (int)subAc.endframe;
             }
             else
             {
                 begin = 0;
                 end   = ac.frames.Count - 1;
             }
             for (int i = begin; i <= end; i++)              //第一层,遍历frame
             {
                 foreach (var box in ac.frames[i].boxesinfo) //第二层遍历box
                 {
                     if (box.mBoxType.Equals("box_attack"))
                     {
                         float pos = (box.mPosition.z + box.mSize.z / 2);
                         if (ai_attribute.attackpos < pos)
                         {
                             ai_attribute.attackpos = pos;
                         }
                     }
                 }
             }
         }
         else if (f.classname.Equals("move") || f.classname.Equals("force"))
         {
             ai_attribute.movenum = (ai_attribute.movenum + f.vecParam0);  //记下位移 作为判断条件
         }
     }
     foreach (var s in table.allStates)
     {
         if (s.conditions.Count == 0)
         {
             continue;
         }
         foreach (var c in s.conditions)
         {
             if (!c.stateBefore.Equals("stand") && !c.stateBefore.Equals("walk"))
             {
                 if (c.stateBefore.Equals(ai_attribute.name))
                 {
                     AI_CanChangeState _s = new AI_CanChangeState();
                     _s.state = s.name;
                     if (c.cmdActive != "5")
                     {
                         _s.cmdstr = c.cmdActive;
                         ai_attribute.canChangeState.Add(_s);
                     }
                 }
             }
         }
     }
     ai_item.cmdAttribute.Insert(0, ai_attribute);
 }