Exemple #1
0
        public void CreateZonesFile(string inputFilename, string outputFilename, string guid, string userName, long userId, string completitionCode, DeviceType device, EngineVersion version)
        {
            FileStream inputStream = null;
            Cartridge  cartridge;

            try
            {
                // Open Lua file
                inputStream = new FileStream(inputFilename, FileMode.Open);

                // Create input object for plain folders
                IInput input = new Folder(inputStream, inputFilename);

                // Check Lua file
                input.Check();

                // Load Lua code and extract all required data
                cartridge = input.Load();

                // Close input
                input = null;
            }
            finally
            {
                if (inputStream != null)
                {
                    inputStream.Close();
                    inputStream = null;
                }
            }

            // Create selected engine
            IEngine engine = Compiler.CreateEngine(device);

            // Convert Lua code and insert special code for this player
            cartridge = engine.ConvertCartridge(cartridge);
            userName  = engine.ConvertString(userName);

            // ---------- Compile Lua code into binary chunk ----------

            // Compile Lua code
            cartridge.Chunk = LUA.Compile(cartridge.LuaCode, cartridge.LuaFileName);

            // ---------- Save cartridge as GWC file ----------

            // Create object for output format (could be also WFC or any other IOutput)
            var outputFormat = new GWC();

            // Write output file
            // Create output in correct format
            var ms = outputFormat.Create(cartridge, userName, userId, completitionCode);

            // Save output to file
            using (FileStream ofs = new FileStream(outputFilename, FileMode.Create)) {
                ms.CopyTo(ofs);
                // Close output
                ofs.Flush();
                ofs.Close();
            }
        }
Exemple #2
0
 // Don't forget to set the variables to false when your object exits the triggers!
 void OnTriggerExit(Collider col)
 {
     if (col.CompareTag("win1"))
     {
         GameObject Flags = GameObject.Find("GameWinCond");
         GWC        _flag = Flags.GetComponent <GWC>();
         _flag.w1 = false;
     }
     if (col.CompareTag("win2"))
     {
         GameObject Flags = GameObject.Find("GameWinCond");
         GWC        _flag = Flags.GetComponent <GWC>();
         _flag.w2 = false;
     }
     if (col.CompareTag("win3"))
     {
         GameObject Flags = GameObject.Find("GameWinCond");
         GWC        _flag = Flags.GetComponent <GWC>();
         _flag.w3 = false;
     }
     if (col.CompareTag("win4"))
     {
         GameObject Flags = GameObject.Find("GameWinCond");
         GWC        _flag = Flags.GetComponent <GWC>();
         _flag.w4 = false;
     }
     if (col.CompareTag("win5"))
     {
         GameObject Flags = GameObject.Find("GameWinCond");
         GWC        _flag = Flags.GetComponent <GWC>();
         _flag.w5 = false;
     }
 }