예제 #1
0
        protected override void SetConditionType(ConditionCompareType compareType)
        {
            switch (compareType)
            {
            case ConditionCompareType.SmallerThanCompare:
            case ConditionCompareType.BiggerThanCompare:
                throw new Exception("The Type is Illeagal whith " + type);

            case ConditionCompareType.EqualsWithCompare:
            case ConditionCompareType.NotEqualsWithCompare:
                this.compareType = compareType;
                break;
            }
        }
예제 #2
0
 public StringTransitionCondition(FsmConditionValue <string> cconditionValue, object CompareValue, ConditionCompareType compareType) : base(cconditionValue, CompareValue, compareType)
 {
 }
예제 #3
0
 /// <summary>
 /// 设置比较值
 /// </summary>
 /// <param name="compareType"></param>
 protected abstract void SetConditionType(ConditionCompareType compareType);
예제 #4
0
 /// <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);
 }
예제 #5
0
 public BoolTransitionCondition(FsmConditionValue <bool> conditionValue, object compareValue, ConditionCompareType compareType) : base(conditionValue, compareValue, compareType)
 {
 }
예제 #6
0
 protected override void SetConditionType(ConditionCompareType compareType)
 {
     this.compareType = compareType;
 }
예제 #7
0
 public FloatTransitionCondition(FsmConditionValue <float> conditionValue, object compareValue, ConditionCompareType compareType) : base(conditionValue, compareValue, compareType)
 {
 }
예제 #8
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>;
 }
예제 #9
0
 /// <summary>
 /// 创建过度条件
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="conditionValName"></param>
 /// <param name="CompareValue"></param>
 /// <param name="CompareType"></param>
 /// <returns></returns>
 public TransitionCondition<T> CreateCondition<T>(string conditionValName, T CompareValue, ConditionCompareType CompareType)
 {
     if (!_conditionValues.ContainsKey(typeof(T)) || !_conditionValues[typeof(T)].ContainsKey(conditionValName))
     {
         Log.E("Please Create ConditionVal First Type " + typeof(T) + "  Name  " + conditionValName);
         return default(TransitionCondition<T>);
     }
     return CreateCondition(_conditionValues[typeof(T)][conditionValName] as FsmConditionValue<T>, CompareValue, CompareType);
 }