ソニックビームで敵を倒す

ソニックビームで敵を倒す
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SonicBeam : MonoBehaviour
{
public GameObject effectPrefab;
public AudioClip sound;
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.CompareTag("Enemy"))
{
Destroy(this.gameObject);
Destroy(collision.gameObject);
Instantiate(effectPrefab, collision.transform.position, Quaternion.identity);
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
}




【2022版】DarkCastle(全39回)
他のコースを見る
ソニックビームで敵を倒す
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SonicBeam : MonoBehaviour
{
public GameObject effectPrefab;
public AudioClip sound;
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.CompareTag("Enemy"))
{
Destroy(this.gameObject);
Destroy(collision.gameObject);
Instantiate(effectPrefab, collision.transform.position, Quaternion.identity);
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
}




ソニックビームで敵を倒す