public override int Eval() { Game g = Game.GetInstance(); g.Debug("Returning constant:" + val); return(val); }
public override void Execute() { Game g = Game.GetInstance(); if (expr.Eval()) { g.Debug("condition is true. executing body"); body.Execute(); } else if (elseNode != null) { g.Debug("condition is false. executing else"); elseNode.Execute(); } }
public override void Execute() { Game g = Game.GetInstance(); int val = rhs.Eval(); g.Debug("Setting " + obj + "." + attr + " to " + val); g.SetObjectAttr(Node.GetLhsObj(obj), attr, val); }
public bool Eval() { Game g = Game.GetInstance(); g.Debug("Evaluating:" + text); if (op.opType == Opr.EQ) { return(lhs.Eval() == rhs.Eval()); } if (op.opType == Opr.NEQ) { return(lhs.Eval() != rhs.Eval()); } if (op.opType == Opr.GT) { return(lhs.Eval() > rhs.Eval()); } if (op.opType == Opr.LT) { return(lhs.Eval() < rhs.Eval()); } return(false); }