rawrrr i'm so scarygit add .
This commit is contained in:
parent
5dcbd3c313
commit
b964c9b617
5 changed files with 433 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
|
|
@ -33,6 +34,8 @@ public class EnemySpawner : MonoBehaviour
|
|||
public Transform bossSpawnPoint;
|
||||
[SerializeField] private GameObject bossUI;
|
||||
[SerializeField] private Transform bossHealthBar;
|
||||
[SerializeField] private TextMeshProUGUI bossHealthText;
|
||||
[SerializeField] private TextMeshProUGUI bossNameText;
|
||||
[Header("Cache")]
|
||||
[SerializeField] private Transform enemyFolder;
|
||||
[SerializeField] private Marisa player;
|
||||
|
|
@ -64,10 +67,12 @@ public class EnemySpawner : MonoBehaviour
|
|||
bossUI.SetActive(true);
|
||||
canSpawn = false;
|
||||
Enemy.OnDamaged += UpdateBossHealthBar; //this kinda sucks but it technically works??
|
||||
bossNameText.text = bossEnemyInstance.entityName;
|
||||
}
|
||||
|
||||
private void UpdateBossHealthBar()
|
||||
{
|
||||
bossHealthBar.localScale = new Vector3(Math.Clamp(bossEnemyInstance.health / bossEnemyInstance.maxHealth, 0, bossEnemyInstance.maxHealth), 1, 1);
|
||||
bossHealthText.text = $"{bossEnemyInstance.health}/{bossEnemyInstance.maxHealth}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using Core.Extensions;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class Marisa : Entity
|
||||
|
|
@ -11,6 +12,7 @@ public class Marisa : Entity
|
|||
public Transform firingPoint;
|
||||
[Header("UI")]
|
||||
[SerializeField] private Transform hpBarUI;
|
||||
[SerializeField] private TextMeshProUGUI healthText;
|
||||
private void Update()
|
||||
{
|
||||
mouseWorldPos = cam.ScreenToWorldPoint(Input.mousePosition);
|
||||
|
|
@ -32,5 +34,6 @@ public class Marisa : Entity
|
|||
private void UpdateHealthUI()
|
||||
{
|
||||
hpBarUI.localScale = new Vector3(Math.Clamp(health/maxHealth,0,maxHealth), 1,1);
|
||||
healthText.text = $"{health}/{maxHealth}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue