ゲームオーバーの作成



ゲームオーバーの作成
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.SceneManagement;
public class GameOver : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
// 相手がEnemyMoveのコンポーネント(スクリプト)を持っているならば(条件)
if (other.TryGetComponent(out EnemyMove em))
{
SceneManager.LoadScene("GameOver");
}
}
}



【2021版】TowerD Ⅱ(全17回)
他のコースを見る


ゲームオーバーの作成
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.SceneManagement;
public class GameOver : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
// 相手がEnemyMoveのコンポーネント(スクリプト)を持っているならば(条件)
if (other.TryGetComponent(out EnemyMove em))
{
SceneManager.LoadScene("GameOver");
}
}
}



ゲームオーバーの作成