ボスの機能の作成⑤(HPとHPスライダーの設定)


ボスのHPの設定
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BossCoreHP : EnemyBase
{
public Slider HPSlider;
void Start()
{
HP = 5;
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);
}
}
}





【2021版】Danmaku(基礎/全55回)
他のコースを見る

ボスのHPの設定
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BossCoreHP : EnemyBase
{
public Slider HPSlider;
void Start()
{
HP = 5;
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);
}
}
}





ボスの機能の作成⑤(HPとHPスライダーの設定)