29 lines
580 B
C#
29 lines
580 B
C#
using UnityEngine;
|
|
|
|
public class Player : Character
|
|
{
|
|
public static Player current { get; private set; }
|
|
|
|
void Awake()
|
|
{
|
|
if (current != null && current != this)
|
|
{
|
|
Debug.LogWarning("Multiple Player instances detected. Destroying duplicate.", gameObject);
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
current = this;
|
|
}
|
|
|
|
void OnDestroy()
|
|
{
|
|
if (current == this) current = null;
|
|
}
|
|
|
|
public override void Die()
|
|
{
|
|
base.Die();
|
|
// add player-specific death logic here
|
|
}
|
|
}
|