Exemplo n.º 1
0
        private int CheckSpecialVar(SymbolTable symbolTable)
        {
            int    ret           = 0;
            String imageFilename = symbolTable.getImageFilename();

            if (imageFilename != null && imageFilename.Length > 0)
            {
                filename = imageFilename;
                symbolTable.setImageFilename("");
            }
            if (symbolTable.get("isFriendBullet") == 1)
            {
                isFriendBullet = true;
            }
            if (symbolTable.get("isPlayer") == 1)
            {
                isPlayer = true;
                ret      = 1;
            }
            if (symbolTable.get("isEnemy") == 1)
            {
                isEnemy = true;
                ret     = 2;
            }
            if (symbolTable.ContainsKey("isScene"))
            {
                isScene = symbolTable.get("isScene") == 1;
            }
            if (symbolTable.ContainsKey("isVisible"))
            {
                isVisible = symbolTable.get("isVisible") == 1;
            }
            return(ret);
        }
Exemplo n.º 2
0
 private void GetObjectInfo(SymbolTable symbolTable)
 {
     setX(symbolTable.get("x"));
     setY(symbolTable.get("y"));
     setVx(symbolTable.get("vx"));
     setVy(symbolTable.get("vy"));
     if (symbolTable.ContainsKey("hp"))
     {
         setHp((int)symbolTable.get("hp"));
     }
 }
Exemplo n.º 3
0
        public double generate(SymbolTable table)
        {
            double t = -1, st, et, pt;

            if (table == null)
            {
                t = 0;
                LogWriter.WriteErrText("SYMBOL TABLE NULL");
            }
            t  = table.get("t");
            st = startExp.generate(table);
            if (endExp != null)
            {
                et = endExp.generate(table);
            }
            else
            {
                et = -1;
            }
            if (periodExp != null)
            {
                pt = periodExp.generate(table);
            }
            else
            {
                pt = -1;
            }
            if (st == -1)
            {
                if (t == 0)
                {
                    return(1);
                }
                return(0);
            }
            else if (st == -2)
            {
                return(table.get("destroy") == 1 ? 1 : 0);
            }
            else if (st <= t && (et == -1 || t <= et))
            {
                if (pt == -1 || lastPeriod == -1 || t - lastPeriod >= pt)
                {
                    lastPeriod = t;
                    return(1);
                }
            }
            return(0);
        }
Exemplo n.º 4
0
        public double generate(SymbolTable table)
        {
            table.ClearUnnecessary();
            double st = table.get("gt");

            if (startTime == -1)
            {
                startTime = st;
                st        = 0;
            }
            else
            {
                st -= startTime;
            }
            table.set("t", st);

            int ret = 1;

            foreach (Exp exp in preExp)
            {
                exp.generate(table);
            }
            foreach (Script_Block sb in script_block)
            {
                if (sb.generate(table) == -1)
                {
                    ret = -1;
                }
            }
            return(ret);
        }
Exemplo n.º 5
0
 public override double generate(SymbolTable table)
 {
     if (table == null)
     {
         LogWriter.WriteErrText("symboltable is null");
         return(0);
     }
     return(table.get(id));
 }
Exemplo n.º 6
0
 public double generate(SymbolTable table)
 {
     foreach (IGenerate stat in statments)
     {
         stat.generate(table);
         if (table.get("destroy") == 1)
         {
             return(-1);
         }
     }
     return(1);
 }
Exemplo n.º 7
0
        public int OnUpdate(SymbolTable symbolTable)
        {
            SetObjectInfo(symbolTable);
            if (script.generate(symbolTable) == -1)
            {
                return(-1);
            }

            GetObjectInfo(symbolTable);

            dt = symbolTable.get("dt");

            x += dt * vx;
            y += dt * vy;

            return(CheckSpecialVar(symbolTable));
        }