Shamba

Skin_selection

Aug 6th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.SceneManagement;
  6.  
  7. public class Skin_Selection : MonoBehaviour {
  8.  
  9.     private string Skin;
  10.     public Text[] Button_texts;
  11.     private int i = 0;
  12.  
  13.     // Use this for initialization
  14.     void Start ()
  15.     {
  16.         Skin = PlayerPrefs.GetString("Skin_type", "Normal");
  17.     }
  18.    
  19.     // Update is called once per frame
  20.     void Update ()
  21.     {
  22.        
  23.     }
  24.     public void Set_Normal()
  25.     {
  26.         PlayerPrefs.SetString("Skin_type", "Normal");
  27.         for(i=0;i<Button_texts.Length;i++)
  28.         {
  29.             if (i == 0)
  30.                 Button_texts[i].text = "Selected";
  31.             else
  32.                 Button_texts[i].text = "Select";
  33.         }
  34.     }
  35.     public void Set_Headphone()
  36.     {
  37.         PlayerPrefs.SetString("Skin_type", "Headphone");
  38.         for (i = 0; i < Button_texts.Length; i++)
  39.         {
  40.             if (i == 1)
  41.                 Button_texts[i].text = "Selected";
  42.             else
  43.                 Button_texts[i].text = "Select";
  44.         }
  45.     }
  46.     public void Play_Game()
  47.     {
  48.         SceneManager.LoadScene(0);
  49.     }
  50. }
Add Comment
Please, Sign In to add comment