アイテムの作成②(スーパークラスの作成)



ItemBase(スーパークラス)の作成
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★「abstract」キーワードを追加すると「抽象クラス」になる(ポイント)
public abstract class ItemBase : MonoBehaviour
{
public AudioClip sound;
public void ItemGet()
{
Destroy(gameObject);
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
【2021版】Danmaku(基礎/全55回)
他のコースを見る


ItemBase(スーパークラス)の作成
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★「abstract」キーワードを追加すると「抽象クラス」になる(ポイント)
public abstract class ItemBase : MonoBehaviour
{
public AudioClip sound;
public void ItemGet()
{
Destroy(gameObject);
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
アイテムの作成②(スーパークラスの作成)