Files
Click-PointRPG/Assets/Scripts/Player.cs

31 lines
679 B
C#

using UnityEngine;
public class Player : Character
{
public static Player current { get; private set; }
protected override void Awake()
{
base.Awake(); // IMPORTANT: Initialize animator and parameters
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
}
}