2024-02-09 22:15:05 +00:00
using GameServer.Controllers.Attributes ;
2024-02-10 16:04:03 +00:00
using GameServer.Systems.Event ;
2024-02-09 22:15:05 +00:00
namespace GameServer.Models ;
2024-02-09 09:20:14 +00:00
internal class ModelManager
{
private PlayerModel ? _playerModel ;
2024-02-10 16:04:03 +00:00
private CreatureModel ? _creatureModel ;
2024-02-09 09:20:14 +00:00
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 ( ) ;
2024-02-10 16:04:03 +00:00
_creatureModel = new CreatureModel ( _playerModel . Id ) ;
2024-02-09 09:20:14 +00:00
}
public PlayerModel Player = > _playerModel ? ? throw new InvalidOperationException ( $"Trying to access {nameof(PlayerModel)} instance before initialization!" ) ;
2024-02-10 16:04:03 +00:00
public CreatureModel Creature = > _creatureModel ? ? throw new InvalidOperationException ( $"Trying to access {nameof(CreatureModel)} instance before initialization!" ) ;
2024-02-09 09:20:14 +00:00
}