// Start is called before the first frame update
 void Start()
 {
     personagemAnimator    = GetComponent <Animator>();
     personagemRigidbody2D = GetComponent <Rigidbody2D>();
     controleBanana        = GameObject.Find("Canvas").GetComponent <Banana>();
     controleCoco          = GameObject.Find("Canvas").GetComponent <Coco>();
     canvas = GameObject.Find("Canvas").GetComponent <Canvas>();
 }
 // Start is called before the first frame update
 void Start()
 {
     p  = GameObject.Find("Pause").GetComponent <Pause>();
     h  = GameObject.Find("Historia").GetComponent <Historia>();
     b  = GameObject.Find("Banana").GetComponent <Banana>();
     c  = GameObject.Find("Coco").GetComponent <Coco>();
     pi = GameObject.Find("Pinha").GetComponent <Pinha>();
     po = GameObject.Find("Portal").GetComponent <Portal>();
 }
示例#3
0
    private void checkIfPassToNextLevel()
    {
        if (!Coco.isAllCocosEaten())
        {
            return;
        }
        if (!firstTime)
        {
            return;
        }

        GetComponents <AudioSource>()[SOUND_INTERMISSION].Play();
        StartCoroutine(newLevelWithDelay());
    }
 // Start is called before the first frame update
 void Start()
 {
     p  = GameObject.Find("Pause").GetComponent <Pause>();
     h  = GameObject.Find("Historia").GetComponent <Historia>();
     po = GameObject.Find("Portal").GetComponent <Portal>();
     b  = GameObject.Find("Banana").GetComponent <Banana>();
     c  = GameObject.Find("Coco").GetComponent <Coco>();
     pi = GameObject.Find("Pinha").GetComponent <Pinha>();
     n  = GameObject.Find("Neve").GetComponent <Neve>();
     h1 = GameObject.Find("HistoriaUm").GetComponent <HistoriaUm>();
     h2 = GameObject.Find("HistoriaDois").GetComponent <HistoriaDois>();
     //por = GameObject.Find("Portugues").GetComponent<Portugues>();
     bra = GameObject.Find("Brasil").GetComponent <Brasil>();
 }
示例#5
0
        public int Save()
        {
            if (id != null)
            {
                return((int)id);
            }


            Coco co = new Coco();

            co.Weight = weight;
            db.Cocos.Add(co);
            db.SaveChanges();

            CocosPackage pc = new CocosPackage();

            pc.age        = age;
            pc.CocosId    = co.Id;
            pc.isFinished = false;
            db.CocosPackages.Add(pc);

            db.SaveChanges();
            return(pc.Id);
        }
        public int Generate(string wszInputFilePath,
                            string bstrInputFileContents, string wszDefaultNamespace,
                            IntPtr[] rgbOutputFileContents, out uint pcbOutput,
                            IVsGeneratorProgress pGenerateProgress)
        {
            // Redirect console output
            StringWriter writer = new StringWriter();

            Console.SetOut(writer);



            // Execute coco
            string[] args = GetCocoArguments(wszInputFilePath, wszDefaultNamespace);
            Console.Write("Console Arguments: ");
            foreach (var s in args)
            {
                Console.Write(s + " ");
            }
            Console.WriteLine();

            int retVal = Coco.Main(args);

            // If success, add parser and scanner
            if (retVal == 0)
            {
                // Get the associated Projetect Item
                ProjectItem pi = GetProjectItem();

                // Check if there are already scanner and parser project items
                bool hasScanner = false;
                bool hasParser  = false;
                bool hasTrace   = false;

                foreach (ProjectItem sub in pi.ProjectItems)
                {
                    if (sub.Name.EndsWith("Scanner.cs"))
                    {
                        hasScanner = true;
                    }
                    if (sub.Name.EndsWith("Parser.cs"))
                    {
                        hasParser = true;
                    }
                    if (sub.Name.EndsWith("trace.txt"))
                    {
                        hasTrace = true;
                    }
                }

                if (!hasParser)
                {
                    pi.ProjectItems.AddFromFile(
                        Path.Combine(Path.GetDirectoryName(wszInputFilePath),
                                     "Parser.cs"));
                }

                if (!hasScanner)
                {
                    pi.ProjectItems.AddFromFile(
                        Path.Combine(Path.GetDirectoryName(wszInputFilePath),
                                     "Scanner.cs"));
                }

                if (!hasTrace
                    &&
                    File.Exists(
                        Path.Combine(Path.GetDirectoryName(wszInputFilePath),
                                     "trace.txt")))
                {
                    pi.ProjectItems.AddFromFile(
                        Path.Combine(Path.GetDirectoryName(wszInputFilePath),
                                     "trace.txt"));
                }
            }
            else
            {
                // Parse console output for error messages
                string          errorText = writer.ToString();
                MatchCollection mc        = Regex.Matches(errorText,
                                                          "-- line ([0-9]*) col ([0-9]*)\\: (.*)");

                // Generate error messages
                foreach (Match match in mc)
                {
                    pGenerateProgress.GeneratorError(0, 1, match.Groups[3].Value,
                                                     uint.Parse(match.Groups[1].Value) - 1,
                                                     uint.Parse(match.Groups[2].Value) - 1);
                }
            }

            //Get the Encoding used by the writer. We're getting the WindowsCodePage encoding,
            //which may not work with all languages
            Encoding enc = Encoding.GetEncoding(writer.Encoding.WindowsCodePage);

            //Get the preamble (byte-order mark) for our encoding
            byte[] preamble       = enc.GetPreamble();
            int    preambleLength = preamble.Length;

            //Convert the writer contents to a byte array
            byte[] body = enc.GetBytes(writer.ToString());

            //Prepend the preamble to body (store result in resized preamble array)
            Array.Resize(ref preamble, preambleLength + body.Length);
            Array.Copy(body, 0, preamble, preambleLength, body.Length);

            int outputLength = preamble.Length;

            rgbOutputFileContents[0] = Marshal.AllocCoTaskMem(outputLength);
            Marshal.Copy(preamble, 0, rgbOutputFileContents[0], outputLength);
            pcbOutput = (uint)outputLength;

            return((retVal == 0) ? VSConstants.S_OK : VSConstants.S_FALSE);
        }
示例#7
0
 /// <summary>
 /// loads the TypeBuilder which was creted during class definition.
 /// </summary>
 /// <param name="t">T.</param>
 public void ImplementMethod(Coco.Token t)
 {
     mb = cb.GetMethodBuilder ( t.val.ToUpper() );
     if (mb == null) {
         throw new CompilerError("unkown method " + t.val );
     } else {
         il =  mb.GetILGenerator();
     }
 }
示例#8
0
 /// <summary>
 /// at end the end of a method implementation we mus emit a RET command
 /// </summary>
 /// <param name="t">T.</param>
 public void EndMethod( Coco.Token t)
 {
     il.Emit (OpCodes.Ret);
 }
示例#9
0
 /// <summary>
 /// creates a MethodBuilder and stores is in this.mbList
 /// </summary>
 /// <param name="t">T.</param>
 public void DefineMethod(Coco.Token t, bool isStatic)
 {
     MethodAttributes attr = 0;
     switch (this.CurrentVisibility)
     {
     case Visibility.publ: attr = MethodAttributes.Public;  break;
     case Visibility.prot: attr = MethodAttributes.Family;  break;
     case Visibility.priv: attr = MethodAttributes.Private; break;
     }
     if (isStatic) {
         attr = attr  | MethodAttributes.Static;
     }
     mb = cb.DefineMethod(t.val.ToUpper(), attr);
 }