//===========================================================================================
        /**
        *  @brief Monobehaviour awak function. Ensures all references are setup before updating
        *         
        *********************************************************************************************/
        public virtual void Awake()
        {
            if (m_charController == null)
                m_charController = GetComponentInChildren<GenericControllerWrapper>();

            m_decoupler = m_charController.GetComponent<MxMAnimationDecoupler>();

            MxMAnimator mxmAnimator = GetComponent<MxMAnimator>();

            if (mxmAnimator.AnimationRoot != null)
            {
                m_rootTransform = mxmAnimator.AnimationRoot;

                if (m_charController == null)
                {
                    m_charController = m_rootTransform.GetComponent<GenericControllerWrapper>();
                }
            }
            else
            {
                m_rootTransform = transform;
            }

            if (m_charController == null)
            {
                Debug.LogWarning("Attached Generic Controller Wrapper is null. " +
                    "Root motion will be applied directly to transform");
            }
        }
        protected abstract void Setup(float[] a_predictionTimes); //Setup function to be implemented for any custom logic based on the prediction times. It is called at the end of SetGoalRequirements.

        //===========================================================================================

        /**
         *  @brief Monobehaviour Awake function called once when the game object is created and before
         *  Start. This implementation ensure the trajectory generator has a reference to all necessary
         *  components.
         *
         *********************************************************************************************/
        protected virtual void Awake()
        {
            p_mxmAnimator = GetComponentInChildren <MxMAnimator>();

            Assert.IsNotNull(p_mxmAnimator, "Cannot initialize MxMTrajectoryGeneratorBase with null MxMAnimator" +
                             "Add an MxMAnimator component");

            p_animator = p_mxmAnimator.GetComponent <Animator>();
        }
예제 #3
0
        public void Initialize()
        {
            m_eventLayers = new List <EventLayerData>(4);
            m_mxmAnimator = GetComponent <MxMAnimator>();

            if (m_mxmAnimator == null)
            {
                Debug.LogError("Could not find MxMAnimator component, MxMEventLayers component disabled");
                enabled = false;
                return;
            }

            m_layerMixer = AnimationLayerMixerPlayable.Create(m_mxmAnimator.MxMPlayableGraph, 1);

            m_layerId   = m_mxmAnimator.AddLayer((Playable)m_layerMixer, 0f, false, null);
            m_baseLayer = m_mxmAnimator.GetLayer(m_layerId);
            m_mxmAnimator.SetLayerWeight(m_layerId, 1f);
        }
예제 #4
0
        //============================================================================================

        /**
         *  @brief Constructor for MxMDebugger.
         *
         *  @param [MxMAnimator] a_animator - reference to the target MxMAnimator that this debug Data
         *  is based on.
         *
         *********************************************************************************************/
        public MxMDebugger(MxMAnimator a_animator, int a_maxMixCount, int a_trajPointCount)
        {
            if (a_animator == null)
            {
                Debug.LogError("Trying to create MxMDebugger, but the MxMAnimator is null. Aborting operation");
                return;
            }

            m_targetAnimator   = a_animator;
            m_debugFrameBuffer = new MxMDebugFrame[DebugFrameCount];

            for (int i = 0; i < m_debugFrameBuffer.Length; ++i)
            {
                m_debugFrameBuffer[i].SetChannelCount(a_maxMixCount);
                m_debugFrameBuffer[i].SetTrajectoryCount(a_trajPointCount);
            }

            m_currentIndex = 0;
            m_usedPoses    = new Dictionary <int, int>();
        }
        private void Start()
        {
            m_maxDecouple = Mathf.Clamp(Mathf.Abs(m_maxDecouple), 0f, float.MaxValue);

            m_controllerWrapper = GetComponent<GenericControllerWrapper>();

            m_mxmAnimator = GetComponentInChildren<MxMAnimator>();

            if(m_mxmAnimator != null)
            {
                m_modelTransform = m_mxmAnimator.transform;
                m_animator = m_mxmAnimator.GetComponent<Animator>();
            }
            else
            {
                Debug.LogError("MxMAnimationDecoupler: Cannot find child component with MxMAnimator attached. Decoupler disabled");
                enabled = false;
            }

            Animator animator = GetComponentInChildren<Animator>();
            if(animator != null)
            {
                if (animator.updateMode == AnimatorUpdateMode.AnimatePhysics)
                    m_fixedUpdate = true;
                else
                    m_fixedUpdate = false;
            }
            else
            {
                Debug.LogError("MxMAnimationDecoupler: Cannot find child component with Animator attached. Decoupler disabled");
                enabled = false;
            }

            m_modelPos = m_modelTransform.position;
            m_modelRot = m_modelTransform.rotation;
        }
예제 #6
0
 public void Setup(ref MxMPlayableState a_state, MxMAnimator m_mxmAnimator)
 {
     ref AnimationMixerPlayable mixer = ref m_mxmAnimator.MixerPlayable;
예제 #7
0
 public StateEvent(MxMAnimator _animator)
 {
     m_animator = _animator;
 }
예제 #8
0
 public StateMatching(MxMAnimator a_animator)
 {
     m_animator = a_animator;
 }
예제 #9
0
 public StateLoopBlend(MxMAnimator a_animator)
 {
     m_animator = a_animator;
 }
예제 #10
0
 public StateIdle(MxMAnimator _animator)
 {
     m_animator = _animator;
 }
예제 #11
0
 //============================================================================================
 /**
 *  @brief Sets the reference to the MxMAnimator. This is done when MxM is initialized
 *  
 *  @param [MxMAnimator] a_mxmAnimator - a reference to the MxMAnimator that this playable
 *  belongs to.
 *         
 *********************************************************************************************/
 public void SetMxMAnimator(MxMAnimator a_mxmAnimator)
 {
     m_mxmAnimator = a_mxmAnimator;
 }