コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     bless_ff = Bless.Get_Bless_f();
     if (bless_ff == true)
     {
         //敵と自分が当たった(ダメージを受けた時)
         hit_check1 = true;
         time_f     = true;
         damage_cnt++;
         //sound02.PlayOneShot(sound02.clip);
         audioSources.PlayOneShot(sound02);
         combo_score_f = true;
         TextPlus.SetActive(true);
         ComboTextPlus.SetActive(true);
         script2.Combo_Score();
         if (damage_cnt == 1)
         {
             HeartObj1.color = new Color(0, 0, 0, alpha.a);
         }
         if (damage_cnt == 2)
         {
             HeartObj2.color = new Color(0, 0, 0, alpha.a);
         }
         if (damage_cnt >= 3)
         {
             you_score     = Score.getScore();
             you_highScore = Score.GetHighScore();
             // スコアを保存する
             PlayerPrefs.SetInt("Score", you_score);
             Scene_name = PlayerPrefs.GetString("Scene_name");
             if (Scene_name == "Stage01")
             {
                 PlayerPrefs.SetInt("highScore1", you_highScore);
             }
             if (Scene_name == "Stage02")
             {
                 PlayerPrefs.SetInt("highScore2", you_highScore);
             }
             if (Scene_name == "Stage03")
             {
                 PlayerPrefs.SetInt("highScore3", you_highScore);
             }
             PlayerPrefs.Save();
             HeartObj3.color = new Color(0, 0, 0, alpha.a);
             SceneManager.LoadScene("GameOver");
             //SceneManager.LoadScene("Reward");
         }
     }
     if (hit_check1 == true)
     {//敵に当たった時、点滅処理
         if (Time.time > nextTime && time_cnt < 40 && time_f == true)
         {
             ren.enabled = !ren.enabled;
             nextTime   += interval;
             time_cnt++;
             if (time_cnt == 40)
             {
                 time_cnt       = 0;
                 time_f         = false;
                 hit_check1     = false;
                 vibration_time = 0;
             }
         }
     }
     if (hit_check1 == false)
     {
         combo_score_f = false;
     }
 }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     bless_ff  = Bless.Get_Bless_f();
     Heart_Add = Skill_Button.GetHeart_Add();
     if (Heart_Add == true)
     {
         GetHeartDate();
         Heart_Add = false;
     }
     Heart_del = false;
     //life_num = Skill_Button.GetHeart();
     Debug.Log("life_num = " + life_num);
     //life_cnt = Skill_Button.HP_restart();
     if (hit_check1 == true)
     {//敵に当たった時、点滅処理
         if (Time.time > nextTime && time_cnt < 40 && time_f == true)
         {
             ren.enabled = !ren.enabled;
             nextTime   += interval;
             time_cnt++;
             if (time_cnt == 40)
             {
                 time_cnt       = 0;
                 time_f         = false;
                 hit_check1     = false;
                 vibration_time = 0;
             }
         }
     }
     if (skill != 4)
     {
         if (life_num == 1)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, alpha.a);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, alpha.a);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
         if (life_num == 2)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, alpha.a);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
         if (life_num == 3)  //スタート時
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
     }
     if (skill == 4)
     {
         if (life_num == 1)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 2)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 3)  //スタート時
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 4)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 5)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0, 255);
         }
         if (life_num == 6)
         {
             HeartObj1.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj2.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj3.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj4.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj5.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             HeartObj6.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
         }
     }
     if (hit_check1 == false)
     {
         combo_score_f = false;
     }
     if (bless_ff == true)
     {
         GetHeartDate();
         if (life_num > 0)
         {
             life_num -= 1;
         }
         SaveHeartDate();
         Heart_del  = true;
         hit_check1 = true;
         time_f     = true;
         damage_cnt++;
         //sound02.PlayOneShot(sound02.clip);
         audioSources.PlayOneShot(sound02);
         combo_score_f = true;
         TextPlus.SetActive(true);
         ComboTextPlus.SetActive(true);
         script2.Combo_Score();
         if (life_num <= 0)
         {
             you_score     = Score_Endless.getScore();
             you_highScore = Score_Endless.gethighScore();
             // スコアを保存する
             PlayerPrefs.SetInt("Score", you_score);
             PlayerPrefs.SetInt("highScore", you_highScore);
             PlayerPrefs.Save();
             SceneManager.LoadScene("GameOver_Endless");
             //SceneManager.LoadScene("Reward");
         }
     }
 }