ゲームクリアーシーン①(シーン遷移の設定)
シーン遷移
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// ★追加
using UnityEngine.SceneManagement;
public class BossCoreHP : EnemyBase
{
public Slider HPSlider;
void Start()
{
HP = 100;
HPSlider.maxValue = HP;
HPSlider.value = HP;
ScoreValue = 2500;
}
public override void TakeDamage(int missilePower)
{
HP -= missilePower;
HPSlider.value = HP;
if(HP<1)
{
this.gameObject.SetActive(false);
GameObject.Find("ScoreManager").GetComponent<ScoreManager>().AddScore(ScoreValue);
// ★追加
SceneManager.LoadScene("GameClear");
}
}
}
【2021版】Danmaku(基礎/全55回)
他のコースを見るシーン遷移
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// ★追加
using UnityEngine.SceneManagement;
public class BossCoreHP : EnemyBase
{
public Slider HPSlider;
void Start()
{
HP = 100;
HPSlider.maxValue = HP;
HPSlider.value = HP;
ScoreValue = 2500;
}
public override void TakeDamage(int missilePower)
{
HP -= missilePower;
HPSlider.value = HP;
if(HP<1)
{
this.gameObject.SetActive(false);
GameObject.Find("ScoreManager").GetComponent<ScoreManager>().AddScore(ScoreValue);
// ★追加
SceneManager.LoadScene("GameClear");
}
}
}
ゲームクリアーシーン①(シーン遷移の設定)