コード例 #1
0
        public bool Get(out float destination, RasterPropMonitorComputer comp)
        {
            if (stateFunction != null)
            {
                bool state = stateFunction();
                destination = state.GetHashCode();
                return true;
            }

            if (value != null)
            {
                destination = value.Value;
                return true;
            }

            destination = comp.ProcessVariable(variableName, -1).MassageToFloat();
            if (float.IsNaN(destination) || float.IsInfinity(destination))
            {
                if (!warningMade)
                {
                    JUtil.LogMessage(owner, "Warning: {0} can fail to produce a usable number.", variableName);
                    warningMade = true;
                    return false;
                }
            }
            return true;
        }
コード例 #2
0
		public VariableOrNumber(string input, RasterPropMonitorComputer compInstance, object caller)
		{
			owner = caller;
			comp = compInstance;
			float realValue;
			if (float.TryParse(input, out realValue))
				value = realValue;
			else
				variableName = input.Trim();
		}
コード例 #3
0
        public VariableOrNumber(string input, RasterPropMonitorComputer compInstance, object caller)
        {
            owner = caller;
            comp  = compInstance;
            float realValue;

            if (float.TryParse(input, out realValue))
            {
                value = realValue;
            }
            else
            {
                variableName = input.Trim();
            }
        }