LeeMace

Immortal

Sep 27th, 2024
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | Gaming | 0 0
  1. //bool
  2. [SerializeField] bool immortal;
  3.  
  4.  public void TakeDamage(int damage) {
  5. //add this if
  6.      if (!immortal) {
  7.          health -= damage;
  8.         // print($"{gameObject.name} Ouch, that hurts {health}");
  9.          if (health <= 0) {
  10.              characterStateMachine.Die();
  11.          }
  12.      }
  13.  }
  14.  
  15. //pause at runtime and check the immortal bool
Tags: immortal
Advertisement
Add Comment
Please, Sign In to add comment