caizhikun

  • 2016년 6월 8일
  • 2016년 5월 13일에 가입함
  • If that is of any help to you @caizhikun, here is how I do it:

    // called each time my hero is created or change his equipment. 
    public void updateSkin() {
        skeletonAnimation.Skeleton.SetAttachment("weapon", "melee/" + Equipment.get("weapon"));
        skeletonAnimation.Skeleton.SetAttachment("shield", "shield/" + Equipment.get("shield"));
        skeletonAnimation.Skeleton.SetAttachment("bow", "range/" + Equipment.get("bow"));
        // etc. idem for armor
        // In my real code I use Constants as Identifier (less error prone)
    }
    

    Equipment is just a Class that store different strings according to what my hero is currently supposed to wear.

    The cool part is, I have put the images used by Spine in Resource file of Unity (eg "Resource/skin/melee/swordIron"). Which means I can also load those image for my Equipment Menu icon for example.