Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.Networking;
- public class PlayerInfo : NetworkBehaviour
- {
- [SyncVar] public int Health = 100;
- public TextMesh tm;
- void Start ()
- {
- transform.name = "Player " + GetComponent<NetworkIdentity> ().netId.ToString ();
- }
- void Update()
- {
- tm.text = transform.name + "/Health "+Health;
- }
- public void GetDamage(int dmg)
- {
- Health -= dmg;
- }
- void OnGUI()
- {
- if (isLocalPlayer)
- {
- GUI.Label(new Rect(Screen.width-100,25,200,50),"Health: "+Health);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement