Skip to content
Snippets Groups Projects
Commit 347eac77 authored by Jason  Rivalino's avatar Jason Rivalino
Browse files

fix: shotgun debug for enemy

parent 0c51b05c
2 merge requests!35feat: fix Game Data,!33merge fix/shotgunEnemy
......@@ -20,6 +20,7 @@ namespace CompleteProject
Light gunLight; // Reference to the light component.
public Light faceLight; // Duh
float effectsDisplayTime = 0.2f; // The proportion of the timeBetweenBullets that the effects will display for.
EnemyHealth enemyHealth; // Reference to the EnemyHealth script.
void Awake()
{
......@@ -36,6 +37,8 @@ namespace CompleteProject
weapon= UnityEngine.GameObject.FindGameObjectsWithTag("Shotgun")[0];
weapon2 = UnityEngine.GameObject.FindGameObjectsWithTag("Shotgun")[1];
enemyHealth = GetComponent<EnemyHealth>();
// UnUse weapon at init state of game
UnUseWeapon();
......@@ -95,10 +98,15 @@ namespace CompleteProject
IEnumerator DestroyLine(GameObject shootLineObject) {
float timeDisplay = timeBetweenAttack* effectsDisplayTime;
if (enemyHealth.currentHealth <= 0) {
timeDisplay = 0;
}
while (timeDisplay > 0) {
timeDisplay-= Time.deltaTime;
yield return null;
}
shootLineObject.GetComponent<LineRenderer>().enabled = false;
Destroy(shootLineObject);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment