void Start() { wordIndex = 0; gameFlowManager = GameObject.Find("GameFlowManager").GetComponent <GameFlowManager>(); initialWordList(); wordOrder = new List <int>(); wordOrder.AddRange(MathTool.DisorderSeq(0, WordList.Count - 1)); //foreach (var item in wordOrder) //{ // print(item); //} StartCoroutine(nextPicture()); }
public void ShowApples() { int RandomAppearance = Random.Range(0, appleImages.Length); //print(RandomAppearance); //Debug.Log("showApples"); int RandomAppleCount = Random.Range(1, 11); //print(RandomAppleCount); int[] applePosRandom = MathTool.DisorderSeq(0, 9); Transform pos; for (int i = 0; i < RandomAppleCount; i++) { //print(applePosRandom [i]); pos = applePos [applePosRandom [i]]; if (!PutOutOfPool(pos)) { //Debug.Log("The apple runned out of use"); GameObject apple = Instantiate(applePrefab, pos); apple.transform.SetParent(null); applesValid.Add(apple); } } float appearRandom = Random.Range(0f, 1f); foreach (GameObject apple in applesValid) { apple.GetComponent <Animator>().SetBool("IsAppear", true); apple.GetComponent <Animator>().SetFloat("ZoomUpBlend", appearRandom); apple.GetComponent <SpriteRenderer>().sprite = appleImages [RandomAppearance]; apple.GetComponent <Rigidbody2D>().gravityScale = 0; } }