コード例 #1
0
        private void LateUpdate()
        {
            if (presentation != null)
            {
                // Update transform.
                transform.localPosition = presentation.Body.Position;
                transform.localRotation = presentation.Body.Rotation;

                // Update animation.
                if (currentCondition != presentation.Condition)
                {
                    // Clear previous animation.
                    ConditionDescriptor conditionDescriptor;
                    if (currentCondition != null)
                    {
                        conditionDescriptor = Descriptors.ForConditions[currentCondition.Id];
                        if (conditionDescriptor.AnimationHash.HasValue)
                        {
                            animator.SetBool(conditionDescriptor.AnimationHash.Value, false);
                        }
                    }

                    // Set current animation.
                    currentCondition = presentation.Condition;
                    animator.SetFloat(speedHash, currentCondition.ConditionSpeed);
                    conditionDescriptor = Descriptors.ForConditions[currentCondition.Id];
                    if (conditionDescriptor.AnimationHash.HasValue)
                    {
                        animator.SetBool(conditionDescriptor.AnimationHash.Value, true);
                    }
                }
            }
        }
コード例 #2
0
        // Methods.

        public string ComposeDescription(IConditionPresentation condition) => descriptionExtractor.Invoke(condition);