public void ChangeRow(bool upward) { MoveBy move = gameObject.AddComponent <MoveBy>(); Vector3 offset = new Vector3(0, StageMap.GRID_HEIGHT, 0); if (!upward) { offset.y = -offset.y; } move.offset = offset; move.time = 0.5f; move.Begin(); model.zombieList[row].Remove(gameObject); if (upward) { ++row; } else { --row; } model.zombieList[row].Add(gameObject); display.SetOrderByRow(row); }
IEnumerator Workflow() { FadeIn fadeIn = logo.AddComponent <FadeIn>(); fadeIn.time = 1.0f; fadeIn.Begin(); yield return(new WaitForSeconds(2f)); FadeOut fadeOut = logo.AddComponent <FadeOut>(); fadeOut.time = 1.0f; fadeOut.Begin(); yield return(new WaitForSeconds(1f)); logo.SetActive(false); loadingLayer.SetActive(true); yield return(new WaitForEndOfFrame()); MoveBy move = title.AddComponent <MoveBy>(); move.offset = new Vector3(0, -2f, 0); move.time = 1f; move.Begin(); yield return(new WaitForSeconds(1f)); async = SceneManager.LoadSceneAsync("MainScene"); async.allowSceneActivation = false; yield return(StartCoroutine(Loading())); text.text = "开始游戏"; button.enabled = true; }
void ProduceSun() { float x = Random.Range(StageMap.GRID_LEFT, StageMap.GRID_RIGTH); float y = Random.Range(StageMap.GRID_BOTTOM, StageMap.GRID_TOP); float startY = StageMap.GRID_TOP + 1.5f; GameObject sun = Instantiate(sunPrefab); sun.transform.position = new Vector3(x, startY, 0); MoveBy move = sun.AddComponent <MoveBy>(); move.offset = new Vector3(0, y - startY, 0); move.time = (startY - y) / 1.0f; move.Begin(); }
IEnumerator GameReady() { yield return(new WaitForSeconds(0.5f)); MoveBy move = Camera.main.gameObject.AddComponent <MoveBy>(); move.offset = new Vector3(3.9f, 0, 0); move.time = 1f; move.Begin(); yield return(new WaitForSeconds(1.5f)); sunLabel.SetActive(true); cardDialog.SetActive(true); }
void ProduceSun() { float x = Random.Range(StageMap.LeftGrid, StageMap.RightGrid); float y = Random.Range(StageMap.BottomGrid, StageMap.TopGrid); float startY = StageMap.TopGrid + 1.5f; GameObject sun = Instantiate(sunPrefab); sun.transform.position = new Vector3(x, startY); MoveBy move = sun.AddComponent <MoveBy>(); move.Offset = new Vector3(0, y - startY, 0); move.MoveTime = (startY - y) / 1f; move.Begin(); }
IEnumerator gameReady() { yield return(new WaitForSeconds(0.5f)); MoveBy move = Camera.main.gameObject.AddComponent <MoveBy>(); //move.Offset = new Vector2(3.25f, 0); move.Offset = new Vector2(5.7f, 0); move.MoveTime = 1.5f; move.Begin(); yield return(new WaitForSeconds(2f)); //sunLabel.SetActive(true); //shovelBg.SetActive(true); btn_sumbit.SetActive(true); toolBar.SetActive(true); //btn_reset.SetActive(true); //cardDialog.SetActive(true); }
void Shoot() { Vector3 pos = transform.position + bulletOffset; GameObject[] bullets = new GameObject[3]; for (int i = 0; i < 3; ++i) { bullets[i] = Instantiate(bullet); bullets[i].transform.position = pos; bullets[i].GetComponent <Bullet>().row = grow.row - 1 + i; bullets[i].GetComponent <SpriteRenderer>().sortingOrder = 1000 * (grow.row + i) + 1; } MoveBy move1 = bullets[0].AddComponent <MoveBy>(); move1.offset.Set(0, StageMap.GRID_HEIGHT, 0); move1.time = 0.2f; move1.Begin(); MoveBy move2 = bullets[2].AddComponent <MoveBy>(); move2.offset.Set(0, -StageMap.GRID_HEIGHT, 0); move2.time = 0.2f; move2.Begin(); }