Advertisement
kadyr

Untitled

Oct 17th, 2021
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class PlayerController : MonoBehaviour
  6. {
  7. //переменная здоровья
  8. private int health;
  9.  
  10.  
  11. [SerializeField]
  12. private Text hpText;
  13. //метод меняющий здоровье
  14. public void ChangeHealth(int hp)
  15. {
  16. health += hp;
  17. hpText.text = health.ToString();
  18. }
  19.  
  20. private void Start()
  21. {
  22. ChangeHealth(100);
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement