public void Generate() { // status int dir = GetDirection(), show_dir = dir; bool is_word = no_words ? false : level.IsWord(); bool is_oppo = level.IsOppo(); // generate if (dir == 0) { show_dir = Random.Range(0, 4); cube = Instantiate(Constant.Instance.ShapePrefab [show_dir]); } else { if (is_oppo) { show_dir = Directions.GetOpposite(dir); } if (is_word) { cube = Instantiate(Constant.Instance.DirPrefab [show_dir - 1]); } else { cube = Instantiate(Constant.Instance.ArrowPrefab); } } // rotate & info cube.transform.parent = transform; if (dir > 0 && is_word == false) { cube.transform.localRotation = Quaternion.Euler(arrow_rotations [show_dir - 1]); } else { cube.transform.localRotation = Quaternion.identity; } cube.transform.localPosition = Vector3.forward * Constant.Instance.CubeGenerateDis; cube.GetComponent <CubeBehavior> ().SetInfo(dir, show_dir, is_word); // set color if (is_oppo && dir > 0) { cube.GetComponent <CubeBehavior> ().SetColor(Constant.Instance.OpposiColor); } else { cube.GetComponent <CubeBehavior> ().SetColor(Constant.Instance.NormalColor); } // add tutorial TutorialAdd(dir == 0, is_oppo); }