예제 #1
0
        /************************************************************************************************************************/

        /// <summary>Returns "AnimancerEvent(normalizedTime, callback)".</summary>
        public override string ToString()
        {
            var text = ObjectPool.AcquireStringBuilder()
                       .Append($"{nameof(AnimancerEvent)}(")
                       .Append(normalizedTime)
                       .Append(", ");

            if (callback == null)
            {
                text.Append("null)");
            }
            else if (callback.Target == null)
            {
                text.Append(callback.Method.Name)
                .Append(")");
            }
            else
            {
                text.Append(callback.Target)
                .Append('.')
                .Append(callback.Method.Name)
                .Append(")");
            }

            return(text.ReleaseToString());
        }
예제 #2
0
        /************************************************************************************************************************/

        /// <summary>Returns a string describing the details of this event.</summary>
        public override string ToString()
        {
            var text = ObjectPool.AcquireStringBuilder();

            text.Append($"{nameof(AnimancerEvent)}(");
            AppendDetails(text);
            text.Append(')');
            return(text.ReleaseToString());
        }
예제 #3
0
        /// <summary>[Editor-Only]
        /// If a <see cref="Source"/> and <see cref="FunctionName"/> have been assigned but the
        /// <see cref="AnimancerState.Clip"/> has no event with that name, this method logs a warning.
        /// </summary>
        private void ValidateSourceHasCorrectEvent()
        {
            if (FunctionName == null || _Source == null || AnimancerUtilities.HasEvent(_Source, FunctionName))
            {
                return;
            }

            var message = ObjectPool.AcquireStringBuilder()
                          .Append("No Animation Event was found in ")
                          .Append(_Source.Clip)
                          .Append(" with the Function Name '")
                          .Append(FunctionName)
                          .Append('\'');

            if (_Source != null)
            {
                message.Append('\n');
                _Source.Root.AppendDescription(message);
            }

            Debug.LogWarning(message.ReleaseToString(), _Source.Root?.Component as Object);
        }