public string Exec(int count, int value) { int x = 0; Random random = new Random(); Stopwatch time = new Stopwatch(); time.Start(); while (x < count) { if (value == 0) { var obj = new Pera(); } else if (value == 1) { Pera obj = new Pera(); } else if (value == 2) { var obj = new Banana(); } else if (value == 3) { var obj = (0 == random.Next(0, 1) ? new Fruta(new Manga()).GetInstance() : new Fruta(new Pera()).GetInstance()); } else { Banana obj = new Banana(); } x++; } time.Stop(); return(time.Elapsed.ToString()); }
public void OnNext(Fruta value) { if (value.GetType() == typeof(Pera)) { last = (Pera)value; listaFinal.Add(last); } }
public static void Main() { Pera miPera = new Pera(); Console.WriteLine(miPera.color()); Fresa miFresa = new Fresa(); Console.WriteLine(miFresa.color()); }
public static void Main(string[] args) { Frutas obj1 = new Manzana(); Frutas obj2 = new Naranja(); Frutas obj3 = new Pera(); Console.WriteLine(obj1.getCost()); Console.WriteLine(obj2.getCost()); Console.WriteLine(obj3.getCost()); }
// Public due to it being referenced by Dialog Background's ContinueButton. public void NextSentence() { continueButton.SetActive(false); gobackButton.SetActive(false); skip.SetActive(false); ReturntoFirstScene.SetActive(false); if (SceneManager.GetActiveScene().name == "7Game_Intro" && index == 1) { inicio.SetActive(false); } if (SceneManager.GetActiveScene().name == "Tutorial" && index == 1) // Esto solo sucede en el tutorial de matemáticas de conteo { Pera.SetActive(true); Manzana2.SetActive(true); Manzana1.SetActive(true); Durazno1.SetActive(true); Durazno2.SetActive(true); source.enabled = false; handanimation.SetActive(true); dialogBackground.SetActive(false); } loader = GameObject.FindWithTag("Cross_Fade"); if (SceneManager.GetActiveScene().name != "New Corrección") { if (index < sentences.Length - 1) { index++; UIText.text = ""; StartCoroutine(Type()); } else { UIText.text = ""; dialogBackground.SetActive(false); if (SceneManager.GetActiveScene().name == "Agradecimiento" /* || SceneManager.GetActiveScene().name == "New Corrección"*/) { endgame.SetActive(true); } else if (loader != null && loader.GetComponent <Levelloader>() != null) { loader.GetComponent <Levelloader>().LoadNextLevel(continuarpresionado); } else { SceneManager.LoadScene(sceneIndex + 1); } } } else { if (index < 3) { index++; UIText.text = ""; StartCoroutine(Type()); } else { UIText.text = ""; dialogBackground.SetActive(false); currentFruitsPanel.gameObject.SetActive(false); currentFruitsIndexesText.gameObject.SetActive(false); //currentFruitsIndexesObject.SetActive(false); endgame.SetActive(true); /*if (SceneManager.GetActiveScene().name == "Agradecimiento"/* || SceneManager.GetActiveScene().name == "New Corrección") * endgame.SetActive(true); * else * SceneManager.LoadScene(sceneIndex+1); */ } } }
string SceneState; //Helps telling in which part of the game we are void Start() { // Commented so that it may be edited in the Inspector, given that each Scene's typing speed differs. typingSpeed = 0.02f; sceneIndex = SceneManager.GetActiveScene().buildIndex; dialogBackground.SetActive(true); continueButton.SetActive(false); gobackButton.SetActive(false); skip.SetActive(false); ReturntoFirstScene.SetActive(false); if (SceneManager.GetActiveScene().name == "Tutorial" && index == 0) //Tutorial de conteo { handanimation = GameObject.FindGameObjectWithTag("Hand"); handanimation.SetActive(false); Pera.SetActive(false); Manzana2.SetActive(false); Manzana1.SetActive(false); Durazno1.SetActive(false); Durazno2.SetActive(false); } if (SceneManager.GetActiveScene().name == "7Game_Intro" && index == 0) { inicio = GameObject.FindGameObjectWithTag("Inicio"); inicio.SetActive(false); } source = GetComponent <AudioSource>(); //individualSource = new AudioSource(); // Scene "Corrección" if (sceneIndex == 23) { // Declare typesOfFruits array. typesOfFruits = new int[initializer.fruits.Length]; // Get total number of fruits instantiated. totalFruits = 0; for (int i = 0; i < initializer.fruits.Length; i++) { totalFruits += FruitInitialization.numFruits[i]; } // Reference Panel displaying current fruits currentFruitsPanel = GameObject.Find("Current Fruits Panel"); //currentFruitsPanel.name = "Pat"; /* Reference Text object which indicates the indexes of each fruit currently displayed in the Current Fruits * Panel. */ //currentFruitsIndexesObject = GameObject.Find("Fruit Indexes"); currentFruitsIndexesText = GameObject.Find("Fruit Indexes") .GetComponent <Text>(); //currentFruitsIndexesObject.GetComponent<Text>(); // Get number of fruits belonging to the first fruit index. for (int i = 0; i < initializer.fruits.Length; i++) { typesOfFruits[i] = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[i]]; } } /* * firstTypeOfFruits = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[0]]; * secondTypeOfFruits = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[1]]; * thirdTypeOfFruits = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[2]]; */ StartCoroutine(Type()); }
public void ExecPera() { var obj = new Fruta(new Pera()).GetInstance(); Pera obj2 = obj; }