Exemplo n.º 1
0
 public StateBinding(StateBinding original)
 {
     if (original != null)
     {
         _stateEntered = new SerializableStateReference(original._stateEntered);
         _parameter    = new SerializableAnimatorControllerParameter(original._parameter);
         _isDelayed    = original._isDelayed;
         _delayTime    = original._delayTime;
     }
 }
Exemplo n.º 2
0
 public SerializableAnimatorControllerParameter(SerializableAnimatorControllerParameter original)
 {
     if (original != null)
     {
         _name       = original._name;
         _type       = original._type;
         _intValue   = original._intValue;
         _floatValue = original._floatValue;
         _boolValue  = original._boolValue;
     }
 }
Exemplo n.º 3
0
        private void DrawParameter(SerializableAnimatorControllerParameter parameter)
        {
            if (parameter.Name != Unassigned)
            {
                switch (parameter.Type)
                {
                case AnimatorControllerParameterType.Bool:
                {
                    var newValue = EditorGUILayout.Toggle("Bool:", parameter.BoolValue);
                    if (parameter.BoolValue != newValue)
                    {
                        MarkDirty();
                        parameter.BoolValue = newValue;
                    }
                    break;
                }

                case AnimatorControllerParameterType.Trigger:
                {
                    var newValue = EditorGUILayout.Toggle("Trigger:", parameter.BoolValue);
                    if (parameter.BoolValue != newValue)
                    {
                        MarkDirty();
                        parameter.BoolValue = newValue;
                    }
                    break;
                }

                case AnimatorControllerParameterType.Int:
                {
                    var newValue = EditorGUILayout.IntField("Int:", parameter.IntValue);
                    if (parameter.IntValue != newValue)
                    {
                        MarkDirty();
                        parameter.IntValue = newValue;
                    }
                    break;
                }

                case AnimatorControllerParameterType.Float:
                {
                    var newValue = EditorGUILayout.FloatField("Float", parameter.FloatValue);
                    if (parameter.FloatValue != newValue)
                    {
                        MarkDirty();
                        parameter.FloatValue = newValue;
                    }
                    break;
                }
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Get an index that represents the parameter in the receiver param arrays. Comparison is made by name.
 /// </summary>
 /// <param name="parameter">
 /// The parameter to look for.
 /// </param>
 private int GetParamIndex(SerializableAnimatorControllerParameter parameter)
 {
     if (parameter != null)
     {
         for (int i = 1; i < _receiverParameterNames.Length; i++)
         {
             if (_receiverParameterNames[i] == parameter.Name)
             {
                 return(i);
             }
         }
     }
     // Couldn't find the parameter, default to "Unassigned"
     return(0);
 }
        public void SetParameter(SerializableAnimatorControllerParameter param)
        {
            if (param != null)
            {
                switch (param.Type)
                {
                case AnimatorControllerParameterType.Int:
                    SetInt(param.Name, param.IntValue);
                    break;

                case AnimatorControllerParameterType.Float:
                    SetFloat(param.Name, param.FloatValue);
                    break;

                case AnimatorControllerParameterType.Bool:
                    SetBool(param.Name, param.BoolValue);
                    break;

                case AnimatorControllerParameterType.Trigger:
                    SetTrigger(param.Name);
                    break;
                }
            }
        }
        private IEnumerator SetParameterAfterDelay(float delayTime, SerializableAnimatorControllerParameter parameter)
        {
            yield return(new WaitForSeconds(delayTime));

            Receiver.SetParameter(parameter);
        }
 public ParameterBinding(SerializableAnimatorControllerParameter parameter)
 {
     _name = parameter.Name;
     _type = parameter.Type;
 }