Files
defrain-shooter-unity/Assets/Scripts/Player/Player.cs
DerTyp187 30a30d7ef5 idk 2
2021-11-01 08:45:45 +01:00

35 lines
684 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class Player : NetworkBehaviour
{
public bool isAlive;
public Team team;
[SerializeField] private const int defaultHp = 100;
public ulong clientId;
[SyncVar(hook = nameof(SetName))]
public string username;
[SerializeField] GameObject usernameTextObj;
public override void OnStartLocalPlayer()
{
base.OnStartClient();
//Load Player Username;
}
public void SetName(string oldName, string newName)
{
username = newName;
usernameTextObj.GetComponent<TMPro.TextMeshPro>().SetText(username);
}
}