Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class PlayerController : MonoBehaviour
- {
- //переменная здоровья
- private int health;
- [SerializeField]
- private Text hpText;
- //метод меняющий здоровье
- public void ChangeHealth(int hp)
- {
- health += hp;
- hpText.text = health.ToString();
- }
- private void Start()
- {
- ChangeHealth(100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement