敵ロボットにHPをつける

敵にHPをつける
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyHP : MonoBehaviour
{
public GameObject effectPrefab;
public AudioClip sound;
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Shell")
{
Destroy(gameObject);
GameObject effect = Instantiate(effectPrefab, transform.position, Quaternion.identity);
Destroy(effect, 0.3f);
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
}





【2019版】TowerD I(基礎/全10回)
1 | 敵ロボットの作成&前進 |
2 | 敵ロボットをターンさせる1 |
3 | 敵ロボットをターンさせる2 |
4 | 敵ロボットにHPをつける |
5 | ロボットを生み出す装置を作る |
6 | マイロボットの作成1 |
7 | マイロボットにライフタイムを設定する |
8 | マイロボットの作成2 |
9 | ★チェックポイント |
10 | ★チャレンジ |

敵にHPをつける
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyHP : MonoBehaviour
{
public GameObject effectPrefab;
public AudioClip sound;
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Shell")
{
Destroy(gameObject);
GameObject effect = Instantiate(effectPrefab, transform.position, Quaternion.identity);
Destroy(effect, 0.3f);
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
}





敵ロボットにHPをつける