fix1
This commit is contained in:
@@ -22,7 +22,18 @@ public class Bullet : MonoBehaviour
|
||||
{
|
||||
if (collision.gameObject.tag == "Enemy")
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
Destroy(collision.gameObject);
|
||||
=======
|
||||
EnemyHealth enemy = collision.gameObject.GetComponent<EnemyHealth>();
|
||||
|
||||
if (enemy != null)
|
||||
{
|
||||
enemy.TakeDamage(damage);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
>>>>>>> parent of 392d236 (Merge branch 'main' of https://git.bib.de/PBA3H25ABU/ClearTheZone)
|
||||
}
|
||||
else if(collision.gameObject.tag == "Wall")
|
||||
{
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyHealth : MonoBehaviour
|
||||
{
|
||||
public int maxHP = 100;
|
||||
private int curHP;
|
||||
|
||||
void Start()
|
||||
{
|
||||
curHP = maxHP;
|
||||
}
|
||||
public void TakeDamage(int damageAmount)
|
||||
{
|
||||
curHP -= damageAmount;
|
||||
|
||||
if (curHP <= 0)
|
||||
{
|
||||
Die();
|
||||
}
|
||||
}
|
||||
|
||||
void Die()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,24 @@ public class Shoot : MonoBehaviour
|
||||
[SerializeField] bool Pistole = true;
|
||||
void Start()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
if (weapon == null)
|
||||
weapon = FindFirstObjectByType<WeaponReload>();
|
||||
>>>>>>> parent of 392d236 (Merge branch 'main' of https://git.bib.de/PBA3H25ABU/ClearTheZone)
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
|
||||
if ( AR == true && Input.GetKey(KeyCode.Mouse0))
|
||||
=======
|
||||
if (PauseMenu.GameIsPaused) return;
|
||||
|
||||
if (AR == true && Input.GetKey(KeyCode.Mouse0) && Time.time >= nextShotTime)
|
||||
>>>>>>> parent of 392d236 (Merge branch 'main' of https://git.bib.de/PBA3H25ABU/ClearTheZone)
|
||||
{
|
||||
Shot(spawnPointAR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user