// Use this for initialization void Start() { int S = MainButton.getS(); Text txt = transform.GetComponent <Text>(); txt.text = StNm[S - 1]; Instantiate(bg[S - 1], new Vector2(130, 480), Quaternion.identity); }
void Gacharu() { //Kekka = GetComponentInChildren<Text>(); int S = MainButton.getS(); //Stage取得 if (S == 1) { Okashi = Random.Range(0, 9); //0行目から8行目 } else if (S == 2) { Okashi = Random.Range(9, 15); //9行目から14行目 } else if (S == 3) { Okashi = Random.Range(15, 21); //15行目から20行目 } candy = CandyList.text; List = candy.Split(char.Parse("\n")); this.targetText = this.GetComponent <Text>(); //お菓子の名前表示する場所 this.targetText.text = List[Okashi]; //お菓子の名前 /*Debug.Log(Okashi-1); * Debug.Log(Sweets2);*/ foreach (Sprite sp in Sweets2) { if ((Okashi).ToString() == sp.name) { Sweets.preserveAspect = true; //比率を変えない Sweets.sprite = sp; } } collect = PlayerPrefs.GetString("CollectList", "000000000000000000000"); string bf; if (Okashi == 0) { bf = ""; } else { bf = collect.Substring(0, Okashi); } string af = collect.Substring(Okashi + 1); collect = bf + 1 + af; PlayerPrefs.SetString("CollectList", collect); PlayerPrefs.Save(); }
void CreateBG() { int S = MainButton.getS(); if (S == 0) { Instantiate(BG[0], new Vector3(1350, 0, 0), Quaternion.identity); Instantiate(BG[0], new Vector3(-810, 0, 0), Quaternion.identity); } else { obj = BG[S - 1]; Instantiate(obj, new Vector3(1350, 0, 0), Quaternion.identity); Instantiate(obj, new Vector3(-810, 0, 0), Quaternion.identity); } }
void CreateGr() { int S = MainButton.getS(); int L = MainButton.getL(); int Stage = 3 * (S - 1) + 1 + L; if (Stage == -5) { Stage = 1; } StrData = StageData.text; StgData = StrData.Split(char.Parse("\n")); int len = StgData[Stage - 1].Length; //lenをステージデータのStage-1行目の長さにする for (int i = 0; i < len - 1; i++) //len回繰り返す //string c= StgData[Stage-1];//cをステージ-1行目のn番目の文字にする { int Ch = int.Parse(StgData[Stage - 1].Substring(i, 1)); obj = Gr[Ch]; Instantiate(obj, new Vector3((540 * i) - 270, -360, 0), Quaternion.identity); } }
void CreateToge() { int S = MainButton.getS(); int L = MainButton.getL(); int Stage = 3 * (S - 1) + 1 + L; StrDatat = TogeData.text; StgDatat = StrDatat.Split(char.Parse("\n")); int len = StgDatat[Stage - 1].Length; //lenをステージデータのStage-1行目の長さにする int n = 0; for (int i = 0; i < len - 1; i++) //len回繰り返す { int Ch = int.Parse(StgDatat[Stage - 1].Substring(i, 1)); if (Ch == 1) { n++; var toge = Instantiate(Toge, new Vector3((540 * i) - 270, -213, 0), Quaternion.identity); toge.name = "Toge" + n; SpriteRenderer img = toge.GetComponent <SpriteRenderer>(); img.sprite = togeimg[S - 1]; } else if (Ch == 2) { n++; var toge = Instantiate(Toge, new Vector3((540 * i) - 270 + 40, -213, 0), Quaternion.identity); var toge2 = Instantiate(Toge, new Vector3((540 * i) - 270 - 40, -213, 0), Quaternion.identity); toge.name = "Toge" + n; n++; toge2.name = "Toge" + n; SpriteRenderer img = toge.GetComponent <SpriteRenderer>(); img.sprite = togeimg[S - 1]; SpriteRenderer img2 = toge2.GetComponent <SpriteRenderer>(); img2.sprite = togeimg[S - 1]; } } }