Addon Animation Tags

Animation Tags

By default all Animations in uMMORPG are played using the skills name. This requires you
to create a unique animation parameter and animation per skill in your game and you cannot
have multiple skills that use the same animation.

This addon solves that issue: instead of using the name, you assign a tag to each skill
and the skill animation is played using this tag (instead of the name). This allows you
to reduce the amont of animation parameters and animations in your project and makes it
possible to re-use the same animation for a number of skills.

Tutoriel for installation

Installation

  1. Open files PLayer.cs, Monster.cs, Pet.cs

  2. Search for this code:

        foreach (Skill skill in skills)
            anim.SetBool(skill.name, skill.CastTimeRemaining() > 0)
  1. Replace with this code:

                 if (state == "CASTING")
                 {
                     // Reset all animation bools for skills
                     foreach (Skill skill in skills.skills)
    #if _iMMOANIMATIONTAGS
                     {
                         //  if (!skill.noAnimation || !skill.animationType == SkillAnimationType.NoAnimation)
                         if (skill.animationType != SkillAnimationType.NoAnimation)
                         {
                             if (skill.animationType == SkillAnimationType.ScriptableName)
                                 animator.SetBool(skill.name, false);
                             else if (skill.animationType == SkillAnimationType.AnimationTag && !string.IsNullOrEmpty(skill.animationTag) && validParameters.Contains(skill.animationTag))
                                 animator.SetBool(skill.animationTag, false);
                         }
                     }
    
                     // Set animation bool for current skill
                     foreach (Skill skill in skills.skills)
                     {
                         if (skills.skills[skills.currentSkill].name == skill.name && skill.level > 0 && !(skill.data is PassiveSkill))
                         {
                             if (skill.animationType != SkillAnimationType.NoAnimation)
                             {
                                 if (skill.animationType == SkillAnimationType.ScriptableName)
                                     animator.SetBool(skill.name, skill.CastTimeRemaining() > 0);
                                 else if (skill.animationType == SkillAnimationType.AnimationTag && !string.IsNullOrEmpty(skill.animationTag) && validParameters.Contains(skill.animationTag))
                                     animator.SetBool(skill.animationTag, skill.CastTimeRemaining() > 0);
                             }
                         }
                     }
    #else
                         animator.SetBool(skill.name, skill.CastTimeRemaining() > 0);
    #endif
                 }
  2. In Player.cs and Monster.cs:

    1. Add this code before the Start() function:
           #if _iMMOANIMATIONTAGS
               List<string> validParameters = new List<string>();
           #endif
    2. Search for the Start() function and add this code before the end of the function:
           #if _iMMOANIMATIONTAGS
               for (int i = 0; i < animator.parameters.Length; i++)
               {
                   validParameters.Add(animator.parameters[i].name);
               }
           #endif
  3. In Pet.cs:

    1. Add this code:

           #if _iMMOANIMATIONTAGS
               List<string> validParameters = new List<string>();
      
               // networkbehaviour ////////////////////////////////////////////////////////
               protected override void Start()
               {
                   for (int i = 0; i < animator.parameters.Length; i++)
                   {
                       validParameters.Add(animator.parameters[i].name);
                   }
               }
           #endif

Requirement

  1. Tools

Add Define

  1. _iMMOANIMATIONTAGS

Video Tutoriel

  1. Video Tutoriel

Addons idea :

addon name
addon name
addon name