WutheringWaves/GameServer/Models/ModelManager.cs

17 lines
477 B
C#
Raw Normal View History

2024-02-09 22:15:05 +00:00
using GameServer.Controllers.Attributes;
using GameServer.Controllers.Event;
namespace GameServer.Models;
2024-02-09 09:20:14 +00:00
internal class ModelManager
{
private PlayerModel? _playerModel;
2024-02-09 22:15:05 +00:00
[GameEvent(GameEventType.Login)]
2024-02-09 09:20:14 +00:00
public void OnLogin()
{
_playerModel = PlayerModel.CreateDefaultPlayer();
}
public PlayerModel Player => _playerModel ?? throw new InvalidOperationException($"Trying to access {nameof(PlayerModel)} instance before initialization!");
}