Änderungen am 14.03.2025 in der Schuel getroffen.
This commit is contained in:
42
Assets/Scripts/GroundSpawner.cs
Normal file
42
Assets/Scripts/GroundSpawner.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NewBehaviourScript : MonoBehaviour
|
||||
{
|
||||
public GameObject Ground1, Ground2, Ground3;
|
||||
bool hasGround = true;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SpawnGround()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// platform "spawn" logic
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Ground"))
|
||||
{
|
||||
hasGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D collision)
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Ground"))
|
||||
{
|
||||
hasGround = false;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GroundSpawner.cs.meta
Normal file
11
Assets/Scripts/GroundSpawner.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a58f8ab6811b9942b34b7598fe7d37f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,5 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -26,6 +24,7 @@ public class Health : MonoBehaviour
|
||||
|
||||
void TakeDamage()
|
||||
{
|
||||
// code from Christian
|
||||
healthbar.fillAmount = (float)currentHealth / (float)maxHealth;
|
||||
|
||||
if (currentHealth <= 0)
|
||||
|
39
Assets/Scripts/Stamina.cs
Normal file
39
Assets/Scripts/Stamina.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
/// <summary>
|
||||
/// code is similar to health
|
||||
/// </summary>
|
||||
public class Stamina : MonoBehaviour
|
||||
{
|
||||
|
||||
public int maxStamina = 9;
|
||||
public int currentStamina = 9;
|
||||
public Image staminabar;
|
||||
|
||||
// stamina logic
|
||||
void Start()
|
||||
{
|
||||
currentStamina = maxStamina;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
UseStamina();
|
||||
}
|
||||
|
||||
void UseStamina()
|
||||
{
|
||||
// code from Christian
|
||||
staminabar.fillAmount = (float)currentStamina / (float)maxStamina;
|
||||
|
||||
// cd for stamina
|
||||
|
||||
// stamina reg
|
||||
|
||||
if (currentStamina < 0)
|
||||
{
|
||||
// longer cd for stamina reg
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Stamina.cs.meta
Normal file
11
Assets/Scripts/Stamina.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9db9cb377ddbbb94f8fc783165e50e5f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user