public void PushSpeedplus() { if (Speed_LV == Speed_MAX) { if (Energy > Speed_energy) { Audio_SE.PlayOneShot(SE_Powerup); Energy -= Speed_energy; Speed += 0.4f; Speed_LV += 1; Speed_MAX += 1; Speed_energy += 600; Speed_gauge[Speed_LV - 1].GetComponent <Image>().fillAmount = 1.0f; LV[2].GetComponent <Text>().text = Speed_MAX.ToString(); LV_energy[2].GetComponent <Text>().text = Speed_energy.ToString(); PlayerPrefs.SetInt("SPEEDMAX", Speed_MAX); energy_score.GetComponent <Text>().text = Energy.ToString(); } } else { Speed += 0.4f; Speed_LV += 1; Speed_gauge[Speed_LV - 1].GetComponent <Image>().fillAmount = 1.0f; } PlayerPrefs.SetInt("ENERGY", Energy); PlayerPrefs.SetFloat("SPEED", Speed); PlayerPrefs.SetInt("SPEEDLV", Speed_LV); PlayerPrefs.SetInt("SPPEDENERGY", Speed_energy); }
// Start is called before the first frame update void Start() { Energy = PlayerPrefs.GetInt("ENERGY", 0); HP = PlayerPrefs.GetInt("HP", 100); Attack = PlayerPrefs.GetInt("ATTACK", 10); Speed = PlayerPrefs.GetFloat("SPEED", 5.0f); shot_speed = PlayerPrefs.GetFloat("S_S", 7.0f); shot_time = PlayerPrefs.GetFloat("S_T", 5.0f); HP_LV = PlayerPrefs.GetInt("HPLV", 1); Attack_LV = PlayerPrefs.GetInt("ATTACKLV", 1); Speed_LV = PlayerPrefs.GetInt("SPEEDLV", 1); Shot_LV = PlayerPrefs.GetInt("SHOTLV", 1); HP_energy = PlayerPrefs.GetInt("HPENERGY", 600); Attack_energy = PlayerPrefs.GetInt("ATTACKENERGY", 600); Speed_energy = PlayerPrefs.GetInt("SPPEDENERGY", 600); Shot_energy = PlayerPrefs.GetInt("SHOTENERGY", 600); HP_MAX = PlayerPrefs.GetInt("HPMAX", 1); Attack_MAX = PlayerPrefs.GetInt("ATTACKMAX", 1); Speed_MAX = PlayerPrefs.GetInt("SPEEDMAX", 1); Shot_MAX = PlayerPrefs.GetInt("SHOTMAX", 1); energy_score = GameObject.Find("Score"); LV[0].GetComponent <Text>().text = HP_MAX.ToString(); LV_energy[0].GetComponent <Text>().text = HP_energy.ToString(); LV[1].GetComponent <Text>().text = Attack_MAX.ToString(); LV_energy[1].GetComponent <Text>().text = Attack_energy.ToString(); LV[2].GetComponent <Text>().text = Speed_MAX.ToString(); LV_energy[2].GetComponent <Text>().text = Speed_energy.ToString(); LV[3].GetComponent <Text>().text = Shot_MAX.ToString(); LV_energy[3].GetComponent <Text>().text = Shot_energy.ToString(); energy_score.GetComponent <Text>().text = Energy.ToString(); for (i = 1; i <= HP_LV; i++) { HP_gauge[i - 1].GetComponent <Image>().fillAmount = 1.0f; } for (i = 1; i <= Attack_LV; i++) { Attack_gauge[i - 1].GetComponent <Image>().fillAmount = 1.0f; } for (i = 1; i <= Speed_LV; i++) { Speed_gauge[i - 1].GetComponent <Image>().fillAmount = 1.0f; } for (i = 1; i <= Shot_LV; i++) { Shot_gauge[i - 1].GetComponent <Image>().fillAmount = 1.0f; } music = PlayerPrefs.GetInt("MUSIC", 1); if (music == 0) { GameObject Audio = Instantiate(AudioPrefab); } Audio_SE = GetComponent <AudioSource>(); }