// HealthComponent.cs (Unity C# Script)
using UnityEngine;
public class HealthComponent : MonoBehaviour
{
public int maxHealth = 100;
private int currentHealth;
void Start()
{
currentHealth = maxHealth;
}
public void TakeDamage(int damage)
{
currentHealth -= damage;
Debug.Log(gameObject.name + " એ " + damage + " ડેમેજ લીધું. બાકી હેલ્થ: " + currentHealth);
if (currentHealth <= 0)
{
Die();
}
}
void Die()
{
Debug.Log(gameObject.name + " મરી ગયું!");
// અહીં Death એનિમેશન અને ગેમ ઓવર લોજિક ઉમેરો
Destroy(gameObject);
}
}
ware is the moon?
New
Comments
- Popular
- New
- Old
You must be signed in to leave a comment
This page doesn't have any comments yet