Änderungen am 12.02.2025 getroffen.

This commit is contained in:
2025-03-12 23:32:43 +01:00
parent 2accb093cb
commit 2bea1ace33
9 changed files with 722 additions and 458 deletions

38
Assets/Scripts/Health.cs Normal file
View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// Link zum OG Script: https://www.youtube.com/watch?v=vNL4WYgvwd8
/// </summary>
public class Health : MonoBehaviour
{
public int maxHealth = 5;
public int currentHealth = 5;
public Image healthbar;
// health logic
void Start()
{
currentHealth = maxHealth;
}
// take dmg logic
private void Update()
{
TakeDamage();
}
void TakeDamage()
{
healthbar.fillAmount = (float)currentHealth / (float)maxHealth;
if (currentHealth <= 0)
{
// player is dead
// death animation
// game over screen
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abeb25a7ebccdd549a934791ddc6ca61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7851c49aa5f61d14eaa1b7262e877d63
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: