Basic game completed

This commit is contained in:
2024-12-09 23:16:34 +01:00
parent 10b694496b
commit 3b30d20e62
457 changed files with 34712 additions and 11643 deletions

View File

@@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class Entity : MonoBehaviour
{
[SerializeField] private float startingHealth;
[SerializeField] private int scoreValue;
private float health;
private Transform player;
public float Health
{
get
{
return health;
}
set
{
if(value <= 0f)
{
Destroy(gameObject);
PlayerHealth playerHealth = player.GetComponent<PlayerHealth>();
playerHealth.AddScore(scoreValue);
}
else health = value;
}
}
void Start()
{
Health = startingHealth;
GameObject playerObject = GameObject.FindWithTag("Player");
if (playerObject != null)
{
player = playerObject.transform;
}
else
{
Debug.LogError("Player not found! Ensure the player has the tag 'Player'.");
}
}
}

View File

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