//
// EntityHelpers.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using NosSmooth.Game.Data.Entities;
using NosSmooth.Packets.Enums.Entities;
namespace NosSmooth.Game.Helpers;
///
/// Helper methods for various operations with entities.
///
public static class EntityHelpers
{
///
/// Create an entity from the given type and id.
///
/// The entity type.
/// The entity id.
/// The entity.
public static IEntity CreateEntity(EntityType type, long entityId)
{
switch (type)
{
case EntityType.Npc:
return new Npc
{
Id = entityId
};
case EntityType.Monster:
return new Monster
{
Id = entityId
};
case EntityType.Player:
return new Player
{
Id = entityId
};
case EntityType.Object:
return new GroundItem
{
Id = entityId
};
}
throw new Exception("Unknown entity type.");
}
}