maint: clean up for gameobject name change in player class

This commit is contained in:
Chris
2025-10-08 22:56:43 -04:00
parent 44e3a3ef7a
commit 7210ed71a9

View File

@@ -22,13 +22,9 @@ namespace Reset.Units{
} }
public void Attach(){ public void Attach(){
name = "Player";
name += IsLocalPlayer ? ", Local" : ", Network";
if (IsLocalPlayer || !UnitIsNetworked()) { // if (IsLocalPlayer || !UnitIsNetworked()) { //
PlayerManager.Player = gameObject; PlayerManager.Player = gameObject;
Debug.Log($"Player is set to {PlayerManager.Player.name}");
PlayerManager.RequestNewController(); PlayerManager.RequestNewController();
GetComponent<LockOnManager>().AttachCamera(gameObject); GetComponent<LockOnManager>().AttachCamera(gameObject);
} }
@@ -37,15 +33,20 @@ namespace Reset.Units{
public override void UnitStart(){ public override void UnitStart(){
base.UnitStart(); base.UnitStart();
SetPlayerName();
Attach(); Attach();
((IKillable)this).IKillableInitialize(); ((IKillable)this).IKillableInitialize();
} }
protected override void Update(){ private void SetPlayerName(){
base.Update(); name = "Player";
if (UnitIsNetworked()){
name += IsLocalPlayer ? ", Local" : ", Network";
}
}
public override void UnitUpdate(){
GetComponent<IKillable>().DrawHealthDebug(); GetComponent<IKillable>().DrawHealthDebug();
Debug.Log(PlayerManager.Player);
} }
public void TakeDamage(DamageSource[] sources){ public void TakeDamage(DamageSource[] sources){