public override void StopModularAnimation(ActorAnimatorLayer layer, string subState)
        {
            ModularBaseState modularState = null;
            int layerIndex = -1;

            if (IsModularStateExisting(layer, subState, out modularState, out layerIndex))
            {
                animator.SetTrigger(string.Format("{0}_Reset", modularState.Name));
                animator.SetBool(modularState.Name, false);

                // FadeIn LayerWeight
                if (modularState.fadeOutDuration > 0f)
                {
                    StartCoroutine(BlendLayer(layerIndex, animator.GetLayerWeight(layerIndex), 0f, modularState.fadeOutDuration));
                }
                else
                {
                    animator.SetLayerWeight(layerIndex, 0f);
                }
            }
            else
            {
                LogErrorFormat("{0}[{2}] (ActorAnimatorController): ModularLayer not found '{1}'.", name, layer, currentState.Name);
            }
        }
        public override bool PlayModularAnimation(string label, ActorAnimatorLayer layer, string subState, UnityAction callback = null)
        {
            AnimationObject         animationObj = null;
            AnimationBaseDefinition definition   = new AnimationBaseDefinition(label);
            ModularBaseState        modularState = null;
            int  layerIndex = -1;
            bool status     = false;

            if (!IsModularStateExisting(layer, subState, out modularState, out layerIndex))
            {
                LogErrorFormat("{0}[{2}] (ActorAnimatorController): ModularLayer not found '{1}'.", name, layer, currentState.Name);
                return(status);
            }

            // Get Animation
            animationObj = modularState.GetAnimation(definition);

            // --- Play Animation ---
            if (animationObj != null && animationObj.clip != null)
            {
                LogFormat("{0} (ActorAnimatorController): Play Modular Animation: '{1}'", name, animationObj.label);

                // Set Animation
                animator.SetBool(modularState.Name, true);
                animator.SetTrigger(animationObj.label); // Play Animation

                // FadeIn LayerWeight
                float layerWeight = animator.GetLayerWeight(layerIndex);

                if (layerWeight < 1f)
                {
                    if (modularState.fadeInDuration > 0f)
                    {
                        StartCoroutine(BlendLayer(layerIndex, animator.GetLayerWeight(layerIndex), 1f, modularState.fadeInDuration));
                    }
                    else
                    {
                        animator.SetLayerWeight(layerIndex, 1f);
                    }
                }

                status = true;

                // Set Callback
                currentModularAnimationCallbacks[0] = callback; // layerIndex - 1
            }
            else
            {
                LogErrorFormat("{0}[{2}] (ActorAnimatorController): ModularAnimationClip is not set '{1}'. Reset weight to '0'.", name, label, currentState.Name);
                animator.SetTrigger(string.Format("{0}_Reset", modularState.Name));
                animator.SetBool(modularState.Name, false);

                // Reset LayerWeight
                animator.SetLayerWeight(layerIndex, 0f);
            }

            return(status);
        }
        protected override bool IsModularStateExisting(ActorAnimatorLayer layer, string subState, out ModularBaseState modularState, out int layerIndex)
        {
            layerIndex   = -1;
            modularState = null;

            switch (layer)
            {
            case ActorAnimatorLayer.Torso:
                modularState = torsoLayerStates.GetSubstate(subState);
                layerIndex   = animator.GetLayerIndex(torsoLayerStates.Layer);
                break;

            default:
                break;
            }

            return((layerIndex > -1) && (modularState != null));
        }
        public override bool ContainsAnimation(string keyword, ActorAnimatorLayer layer)
        {
            bool status = false;

            switch (layer)
            {
            case ActorAnimatorLayer.Base:
                status = currentState.ContainsAnimation(keyword);
                break;

            case ActorAnimatorLayer.Torso:
                status = torsoLayerStates.ContainsAnimation(keyword);
                break;

            default:
                break;
            }

            return(status);
        }
 protected abstract bool IsModularStateExisting(ActorAnimatorLayer layer, string subState, out ModularBaseState modularState, out int layerIndex);
 public virtual void StopModularAnimation(ActorAnimatorLayer layer, string subState)
 {
     throw new NotImplementedException();
 }
 public virtual bool PlayModularAnimation(string label, ActorAnimatorLayer layer, string subState, UnityAction callback = null)
 {
     throw new NotImplementedException();
 }
 public abstract bool ContainsAnimation(string keyword, ActorAnimatorLayer layer);