Advertisement
Sebsebeleb

Player.cs

Jan 21st, 2022 (edited)
881
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2.  
  3. public class Player : MonoBehaviour, ICollision, IHealth
  4. {
  5.     public float Health;
  6.    
  7.     public void TakeDamage()
  8.     {
  9.         Health -= 1;
  10.  
  11.         if (Health <= 0)
  12.         {
  13.             Die();
  14.         }
  15.            
  16.     }
  17.    
  18.     public void Die()
  19.     {
  20.         Destroy(gameObject);
  21.     }
  22.  
  23.     public void Collided()
  24.     {
  25.         TakeDamage();
  26.     }
  27. }
  28.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement