Initial Commit

This commit is contained in:
Simeon Radivoev 2022-02-12 12:53:50 +02:00
commit ee5c2f922d
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
2255 changed files with 547750 additions and 0 deletions

View file

@ -0,0 +1,37 @@
using UnityEngine;
namespace DefaultNamespace
{
public static class AnimatorExtensions
{
public static void SetFloatSafe(this Animator animator, int hash, float value)
{
if (animator.Exists(hash))
{
animator.SetFloat(hash, value);
}
}
public static void SetBoolSafe(this Animator animator, int hash, bool value)
{
if (animator.Exists(hash))
{
animator.SetBool(hash, value);
}
}
public static bool Exists(this Animator animator, int hash)
{
var paramCount = animator.parameterCount;
var p = animator.parameters;
for (var i = 0; i < paramCount; i++)
{
if (p[i].nameHash == hash)
{
return true;
}
}
return false;
}
}
}