Пример #1
0
 public void Reset()
 {
     this.conditionParam     = null;
     this.conditionParamType = EventConditionParamTypes.Int;
     this.conditionMode      = EventConditionModes.Equal;
     this.floatValue         = 0f;
     this.intValue           = 0;
     this.boolValue          = false;
 }
Пример #2
0
 public void Reset()
 {
     this.conditionParam = null;
     this.conditionParamType = EventConditionParamTypes.Int;
     this.conditionMode = EventConditionModes.Equal;
     this.floatValue = 0f;
     this.intValue = 0;
     this.boolValue = false;
 }
Пример #3
0
    public bool Test(Animator animator)
    {
        if (this.conditions.Count == 0)
        {
            return(true);
        }
        for (int i = 0; i < this.conditions.Count; i++)
        {
            EventConditionEntry eventConditionEntry = this.conditions[i];
            if (!string.IsNullOrEmpty(eventConditionEntry.conditionParam))
            {
                EventConditionParamTypes conditionParamType = eventConditionEntry.conditionParamType;
                if (conditionParamType != EventConditionParamTypes.Int)
                {
                    if (conditionParamType != EventConditionParamTypes.Float)
                    {
                        if (conditionParamType == EventConditionParamTypes.Boolean)
                        {
                            bool @bool = animator.GetBool(eventConditionEntry.conditionParam);
                            if (@bool != eventConditionEntry.boolValue)
                            {
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        float @float = animator.GetFloat(eventConditionEntry.conditionParam);
                        EventConditionModes conditionMode = eventConditionEntry.conditionMode;
                        if (conditionMode != EventConditionModes.GreaterThan)
                        {
                            if (conditionMode == EventConditionModes.LessThan)
                            {
                                if (@float >= eventConditionEntry.floatValue)
                                {
                                    return(false);
                                }
                            }
                        }
                        else if (@float <= eventConditionEntry.floatValue)
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    int integer = animator.GetInteger(eventConditionEntry.conditionParam);
                    switch (eventConditionEntry.conditionMode)
                    {
                    case EventConditionModes.Equal:
                        if (integer != eventConditionEntry.intValue)
                        {
                            return(false);
                        }
                        break;

                    case EventConditionModes.NotEqual:
                        if (integer == eventConditionEntry.intValue)
                        {
                            return(false);
                        }
                        break;

                    case EventConditionModes.GreaterThan:
                        if (integer <= eventConditionEntry.intValue)
                        {
                            return(false);
                        }
                        break;

                    case EventConditionModes.LessThan:
                        if (integer >= eventConditionEntry.intValue)
                        {
                            return(false);
                        }
                        break;

                    case EventConditionModes.GreaterEqualThan:
                        if (integer < eventConditionEntry.intValue)
                        {
                            return(false);
                        }
                        break;

                    case EventConditionModes.LessEqualThan:
                        if (integer > eventConditionEntry.intValue)
                        {
                            return(false);
                        }
                        break;
                    }
                }
            }
        }
        return(true);
    }