예제 #1
0
    public void Step(NCSContext context)
    {
        context.script = this;
        NCSInstruction instruction = instructions[context.GetPC()];

        //Debug.Log(instruction.AsString());

        instruction.Run(context);
        if (instruction.IncrementsPC)
        {
            //Debug.Log("Incrementing PC");
            context.Step();
        }

        lastInstruction = instruction;
    }
예제 #2
0
    public NCSScript(Stream stream, string name)
    {
        // if (actions == null)
        // {
        //     ReadActions();
        // }
        // We read the NCS file directly from the stream
        file       = new NCSFile(stream);
        scriptName = name;

        foreach (NCSOperation op in file.operations)
        {
            NCSInstruction instruction = (NCSInstruction)Activator.CreateInstance(op.opType);
            //Debug.Log(instruction);

            instruction.Initialize(op.args, this);
            instructions.Add(instruction);
        }
    }