It looks like you're new here. If you want to get involved, click one of these buttons!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public int fallBoundary = -20;
[System.Serializable]
public class PlayerStats
{
public int health = 100;
}
PlayerStats playerStats = new PlayerStats();
private void Update()
{
if (transform.position.y <= fallBoundary)
{
DamagePlayer(999999);
}
}
public void DamagePlayer(int damage)
{
playerStats.health -= damage;
if (playerStats.health <= 0)
GameMaster.KillPlayer(this);
}
}
Answers
I got it in other forum very b4, but ty ... how to delete threads?