feat: add NetworkVariables for PlayerPrefab
This commit is contained in:
parent
f71816e918
commit
e6b688aafe
@ -8,6 +8,21 @@ public class Trooper : RobotController
|
||||
// Dev Debug Staff
|
||||
[SerializeField] Canvas screenSpaceCanvas;
|
||||
|
||||
[Header("Gameplay Variables")]
|
||||
private NetworkVariable<int> healthPoints = new NetworkVariable<int>();
|
||||
public int HealthPoints { get { return healthPoints.Value; } set { healthPoints.Value = value; } }
|
||||
|
||||
private NetworkVariable<int> armorPoints = new NetworkVariable<int>();
|
||||
public int ArmorPoints { get { return armorPoints.Value; } set { armorPoints.Value = value; } }
|
||||
|
||||
private NetworkVariable<int> ammoPoints = new NetworkVariable<int>();
|
||||
public int AmmoPoints { get { return ammoPoints.Value; } set { ammoPoints.Value = value; } }
|
||||
|
||||
[SerializeField] private int initialHP = 100;
|
||||
public int InitialHP { get => initialHP; set => initialHP = value; }
|
||||
|
||||
[SerializeField] private int initialArmor = 100;
|
||||
public int InitialArmor { get => initialArmor; set => initialArmor = value; }
|
||||
// Gameplay - Scene Awake & Start
|
||||
private void Awake()
|
||||
{
|
||||
@ -44,7 +59,11 @@ public class Trooper : RobotController
|
||||
audioListener.enabled = IsOwner;
|
||||
screenSpaceCanvas.enabled = IsOwner;
|
||||
|
||||
// Game Variables
|
||||
healthPoints.Value = InitialHP;
|
||||
|
||||
Debug.Log($"NetworkObject ID: {NetworkObjectId} spawned with OwnerClientId: {OwnerClientId}");
|
||||
Debug.Log($"HP of OwnerClientID: {OwnerClientId} is {healthPoints.Value} when spawned.");
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
|
Loading…
x
Reference in New Issue
Block a user