Exemplo n.º 1
0
        public NValue Clone()
        {
            var rValue = new NValue();

            rValue.Type   = Type;
            rValue.Object = Object;

            return(rValue);
        }
Exemplo n.º 2
0
 // 设置变量
 public void SetVariable(string strVariable, NValue rValue)
 {
     if (false == TableVariable.ContainsKey(strVariable))
     {
         TableVariable.Add(strVariable, rValue);
     }
     else
     {
         TableVariable[strVariable] = rValue;
     }
 }
Exemplo n.º 3
0
        // 获取变量
        public NValue GetVariable(string strVariable)
        {
            NValue rResult = null;

            if (!TableVariable.TryGetValue(strVariable, out rResult))
            {
                return(NValue.Zero);
            }

            return(rResult);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据断句获得表达式
        /// </summary>
        /// <param name="rToken"></param>
        /// <returns></returns>
        private Expression GetExpression(ExpressionToken rToken)
        {
            if (rToken.Type == ExpressionToken.eType.Identifier)
            {
                return(new ExpressionVariable(rToken.Value));
            }
            if (rToken.Type == ExpressionToken.eType.Operand)
            {
                return(new ExpressionValue(new NValue(BehaviourTreeAssists.ToValue(rToken.Value))));
            }
            if (rToken.Type == ExpressionToken.eType.String)
            {
                var rValue = new NValue();
                rValue.SetValueString(rToken.Value);
                return(new ExpressionValue(rValue));
            }
            if (rToken.Type == ExpressionToken.eType.Expression)
            {
                return(rToken.Expression);
            }

            return(null);
        }
Exemplo n.º 5
0
 public ExpressionValue(NValue strValue)
 {
     Value = strValue;
 }
Exemplo n.º 6
0
 protected bool Equals(NValue other)
 {
     return(Equals(Object, other.Object) && Equals(Type, other.Type));
 }