예제 #1
0
        public override int Eval()
        {
            Game g = Game.GetInstance();

            g.Debug("Returning constant:" + val);
            return(val);
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }