コード例 #1
0
ファイル: Expression.cs プロジェクト: bestm80eva/Lantern
        public override int Eval()
        {
            Game g = Game.GetInstance();

            g.Debug("Returning constant:" + val);
            return(val);
        }
コード例 #2
0
ファイル: Expression.cs プロジェクト: bestm80eva/Lantern
        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
ファイル: Expression.cs プロジェクト: bestm80eva/Lantern
        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
ファイル: Expression.cs プロジェクト: bestm80eva/Lantern
        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);
        }