Files
defrain-shooter-unity/Assets/Scripts/Player/Player.cs
2021-11-04 08:07:46 +01:00

31 lines
654 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;
[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);
}
}