public VarRef(VarValue v) { mVarName = null; mTrigger = null; Value = v; }
//冥 public static VarValue Power(VarValue lhs, VarValue rhs) { if (false == lhs.IsNil || false == rhs.IsNil) { if (lhs.mEType == rhs.mEType) { if (rhs.mEType == EType.Int) { return(new VarValue((int)UnityEngine.Mathf.Pow((int)lhs.mValue, (int)rhs.mValue))); } else if (rhs.mEType == EType.Float) { return(new VarValue((float)UnityEngine.Mathf.Pow((float)lhs.mValue, (float)rhs.mValue))); } } else { if (rhs.mEType == EType.Float) { if (lhs.mEType == EType.Int) { return(new VarValue((int)UnityEngine.Mathf.Pow((int)lhs.mValue, (float)rhs.mValue))); } } else if (rhs.mEType == EType.Int) { if (lhs.mEType == EType.Float) { return(new VarValue((float)UnityEngine.Mathf.Pow((float)lhs.mValue, (int)rhs.mValue))); } } } } throw new System.NotSupportedException(lhs.ToString() + " Pow(" + rhs.ToString() + ") not supported."); }
public static VarRef Deserialize(Stream stream, Trigger trigger) { using (BinaryReader r = new BinaryReader(stream)) { if (r.ReadBoolean()) { BinaryFormatter b = new BinaryFormatter(); VarValue varValue = b.Deserialize(stream) as VarValue; return(new VarRef(varValue)); } else { string name = r.ReadString(); return(new VarRef(name, trigger)); } } }
//if is variable name, it must be bracketed in % public static VarRef GetVarRefOrValue(XmlNode xmlNode, string name, VarValue.EType eType, Trigger trigger) { VarRef varRef = null; string text = Util.GetString(xmlNode, name); if (IsVarName(text)) { string varName = GetVarName(text); varRef = new VarRef(varName, trigger); } else { VarValue varValue = GetVarValue(text, eType); varRef = new VarRef(varValue); } return(varRef); }
public override void Do() { mTarget.Value = VarValue.Power(mTarget.Value, mArg.Value); }
public Variable() { mValue = null; }
public Variable(VarValue v) { mValue = v; }