Skip to content

Commit

Permalink
added all of the health systems for player, changed limbHealth to Bod…
Browse files Browse the repository at this point in the history
…yPartDamage, modified bulletHealth to work with BodyPartDamage
  • Loading branch information
soulsyrup committed Jan 2, 2024
1 parent 399ef4b commit 06e4832
Show file tree
Hide file tree
Showing 37 changed files with 850 additions and 30 deletions.
8 changes: 8 additions & 0 deletions DarkFlow/Assets/Scripts/AI.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions DarkFlow/Assets/Scripts/AI/NPC.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using UnityEngine;
using UnityEngine.UI;

public class AdrenalineTrigger : MonoBehaviour
{
private float adrenalineLevel = 0f;
public float adrenalineTriggerThreshold = 20f; // Threshold for adrenaline boost
public Image adrenalineBar;
HealthRegeneration healthScript;

private void Start()
{
healthScript = GetComponent<HealthRegeneration>();
}

private void Update()
{
if (healthScript.currentHealth <= adrenalineTriggerThreshold && adrenalineLevel < 100f)
{
adrenalineLevel += Time.deltaTime * 50f; // Increase adrenaline
UpdateAdrenalineBar();
}
else
{
adrenalineLevel = 0f;
UpdateAdrenalineBar();
}
}

private void UpdateAdrenalineBar()
{
if(adrenalineBar != null)
{
adrenalineBar.fillAmount = adrenalineLevel / 100f;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using UnityEngine;
using UnityEngine.UI;

public class HealthRegeneration : MonoBehaviour
{
public float maxHealth = 100f;
private float currentHealth;
public Image healthBar;

private void Start()
{
currentHealth = maxHealth;
}

private void Update()
{
// Regenerate health logic
if (currentHealth < maxHealth)
{
currentHealth += Time.deltaTime * 5f; // Regeneration rate
currentHealth = Mathf.Min(currentHealth, maxHealth);
UpdateHealthBar();
}
}

private void UpdateHealthBar()
{
if(healthBar != null)
{
healthBar.fillAmount = currentHealth / maxHealth;
}
}
}
37 changes: 37 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/AdrenalineTrigger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using UnityEngine;
using UnityEngine.UI;

public class AdrenalineTrigger : MonoBehaviour
{
private float adrenalineLevel = 0f;
public float adrenalineTriggerThreshold = 20f; // Threshold for adrenaline boost
public Image adrenalineBar;
private HealthRegeneration healthScript;

private void Start()
{
healthScript = GetComponent<HealthRegeneration>();
}

private void Update()
{
if (healthScript.GetCurrentHealth() <= adrenalineTriggerThreshold && adrenalineLevel < 100f)
{
adrenalineLevel += Time.deltaTime * 50f; // Increase adrenaline
UpdateAdrenalineBar();
}
else
{
adrenalineLevel = 0f;
UpdateAdrenalineBar();
}
}

private void UpdateAdrenalineBar()
{
if (adrenalineBar != null)
{
adrenalineBar.fillAmount = adrenalineLevel / 100f;
}
}
}
11 changes: 11 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/AdrenalineTrigger.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/ArmorIntegrity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using UnityEngine;
using UnityEngine.UI; // Required for UI elements

public class ArmorIntegrity : MonoBehaviour
{
public float maxIntegrity = 100f;
private float currentIntegrity;

public Image integrityBar; // UI Image to represent armor integrity visually

void Start()
{
currentIntegrity = maxIntegrity;
UpdateArmorUI(); // Initialize UI
}

void Update()
{
// Optional: Add any continuous logic, if required
}

public void TakeDamage(float damage)
{
currentIntegrity -= damage;
currentIntegrity = Mathf.Clamp(currentIntegrity, 0, maxIntegrity);
UpdateArmorUI();
}

public void RepairArmor(float repairAmount)
{
currentIntegrity += repairAmount;
currentIntegrity = Mathf.Clamp(currentIntegrity, 0, maxIntegrity);
UpdateArmorUI();
}

private void UpdateArmorUI()
{
if (integrityBar != null)
{
integrityBar.fillAmount = currentIntegrity / maxIntegrity;
}
// If using Text UI, update the text to display currentIntegrity
}
}
11 changes: 11 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/ArmorIntegrity.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/AugmentationIntegrity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using UnityEngine;
using UnityEngine.UI; // Required for UI elements

public class AugmentationIntegrity : MonoBehaviour
{
public float maxIntegrity = 100f;
private float currentIntegrity;

public Image integrityBar; // UI element to represent integrity visually

void Start()
{
currentIntegrity = maxIntegrity;
UpdateAugmentationUI(); // Initialize UI
}

void Update()
{
// Optional: Add any continuous logic, if required
}

public void TakeDamage(float damage)
{
currentIntegrity -= damage;
currentIntegrity = Mathf.Clamp(currentIntegrity, 0, maxIntegrity);
CheckForMalfunctions();
UpdateAugmentationUI();
}

public void RepairAugmentation(float repairAmount)
{
currentIntegrity += repairAmount;
currentIntegrity = Mathf.Clamp(currentIntegrity, 0, maxIntegrity);
UpdateAugmentationUI();
}

private void CheckForMalfunctions()
{
if (currentIntegrity <= 0)
{
// Handle augmentation malfunction, e.g., disable certain abilities
}
}

private void UpdateAugmentationUI()
{
if (integrityBar != null)
{
integrityBar.fillAmount = currentIntegrity / maxIntegrity;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/BioToxicityMeter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using UnityEngine;
using UnityEngine.UI;

public class BioToxicityMeter : MonoBehaviour
{
public float maxBioToxicity = 100f;
private float currentBioToxicity = 0f;
public Image bioToxicityBar; // Assign this in the Inspector

void Update()
{
// Update logic, if any, goes here
}

public void IncreaseToxicity(float amount)
{
currentBioToxicity += amount;
currentBioToxicity = Mathf.Clamp(currentBioToxicity, 0, maxBioToxicity);
UpdateToxicityUI();
}

public void DecreaseToxicity(float amount)
{
currentBioToxicity -= amount;
currentBioToxicity = Mathf.Clamp(currentBioToxicity, 0, maxBioToxicity);
UpdateToxicityUI();
}

private void UpdateToxicityUI()
{
bioToxicityBar.fillAmount = currentBioToxicity / maxBioToxicity;
}
}
11 changes: 11 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/BioToxicityMeter.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/BloodLossStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using UnityEngine;
using UnityEngine.UI;

public class BloodLossStatus : MonoBehaviour
{
public float maxBlood = 100f;
private float currentBlood;
public Image bloodBar;

void Start()
{
currentBlood = maxBlood;
UpdateBloodBar();
}

void Update()
{
// Logic to decrease blood based on player injuries
currentBlood = Mathf.Clamp(currentBlood, 0, maxBlood);
UpdateBloodBar();
}

public void ReceiveInjury(float amount)
{
currentBlood -= amount;
currentBlood = Mathf.Clamp(currentBlood, 0, maxBlood);
UpdateBloodBar();
}

private void UpdateBloodBar()
{
if (bloodBar != null)
{
bloodBar.fillAmount = currentBlood / maxBlood;
}
}
}
11 changes: 11 additions & 0 deletions DarkFlow/Assets/Scripts/CharacterSystems/BloodLossStatus.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 06e4832

Please sign in to comment.