Beispiel #1
0
 /// <summary>
 /// 创建过度条件
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="value"></param>
 /// <param name="CompareValue"></param>
 /// <param name="CompareType"></param>
 /// <returns></returns>
 public TransitionCondition<T> CreateCondition<T>(FsmConditionValue<T> value, T CompareValue, ConditionCompareType CompareType)
 {
     ITransitionCondition condtion;
     if (typeof(T) == typeof(bool))
         condtion = new BoolTransitionCondition(value as FsmConditionValue<bool>, CompareValue, CompareType);
     else if (typeof(T) == typeof(string))
         condtion = new StringTransitionCondition(value as FsmConditionValue<string>, CompareValue, CompareType);
     else if (typeof(T) == typeof(float))
         condtion = new FloatTransitionCondition(value as FsmConditionValue<float>, CompareValue, CompareType);
     else if (typeof(T) == typeof(int))
         condtion = new IntTransitionCondition(value as FsmConditionValue<int>, CompareValue, CompareType);
     else
         throw new Exception("Fault Type Of T   " + typeof(T));
     return condtion as TransitionCondition<T>;
 }
 public StringTransitionCondition(FsmConditionValue <string> cconditionValue, object CompareValue, ConditionCompareType compareType) : base(cconditionValue, CompareValue, compareType)
 {
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="cconditionValue">改变的数值</param>
 /// <param name="compareValue">比较的默认值</param>
 /// <param name="compareType">比较方式</param>
 protected TransitionCondition(FsmConditionValue <T> cconditionValue, object compareValue, ConditionCompareType compareType)
 {
     this._conditionValue = cconditionValue;
     this._compareValue   = (T)compareValue;
     SetConditionType(compareType);
 }
 public BoolTransitionCondition(FsmConditionValue <bool> conditionValue, object compareValue, ConditionCompareType compareType) : base(conditionValue, compareValue, compareType)
 {
 }
 public FloatTransitionCondition(FsmConditionValue <float> conditionValue, object compareValue, ConditionCompareType compareType) : base(conditionValue, compareValue, compareType)
 {
 }