public void PushShotplus() { if (Shot_LV == Shot_MAX) { if (Energy > Shot_energy) { Audio_SE.PlayOneShot(SE_Powerup); Energy -= Shot_energy; shot_speed += 0.25f; shot_time += 0.15f; Shot_LV += 1; Shot_MAX += 1; Shot_energy += 600; Shot_gauge[Shot_LV - 1].GetComponent <Image>().fillAmount = 1.0f; LV[3].GetComponent <Text>().text = Shot_MAX.ToString(); LV_energy[3].GetComponent <Text>().text = Shot_energy.ToString(); PlayerPrefs.SetInt("SHOTMAX", Shot_MAX); energy_score.GetComponent <Text>().text = Energy.ToString(); } } else { shot_speed += 0.25f; shot_time += 0.15f; Shot_LV += 1; Shot_gauge[Shot_LV - 1].GetComponent <Image>().fillAmount = 1.0f; } PlayerPrefs.SetInt("ENERGY", Energy); PlayerPrefs.SetFloat("S_S", shot_speed); PlayerPrefs.SetFloat("S_T", shot_time); PlayerPrefs.SetInt("SHOTLV", Shot_LV); PlayerPrefs.SetInt("SHOTENERGY", Shot_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>(); }