feat: add npc and players

This commit is contained in:
k0t9i 2023-01-28 16:44:41 +04:00
parent 340e91b325
commit 4778f1c478
5 changed files with 83 additions and 0 deletions

View File

@ -42,10 +42,14 @@ namespace Client
.AddTransient(typeof(EntityFactoryInterface<Hero>), typeof(EntityFactory<Hero>))
.AddTransient(typeof(EntityFactoryInterface<Drop>), typeof(EntityFactory<Drop>))
.AddTransient(typeof(EntityFactoryInterface<NPC>), typeof(EntityFactory<NPC>))
.AddTransient(typeof(EntityFactoryInterface<Player>), typeof(EntityFactory<Player>))
.AddTransient(typeof(EntityFactoryInterface<ChatMessage>), typeof(EntityFactory<ChatMessage>))
.AddSingleton<EntityHandler<Hero>>()
.AddSingleton<EntityHandler<Drop>>()
.AddSingleton<EntityHandler<NPC>>()
.AddSingleton<EntityHandler<Player>>()
.AddSingleton<ChatMessageHandler>();
})
.Build();

View File

@ -0,0 +1,32 @@
using Client.Domain.Enums;
using Client.Domain.ValueObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Client.Domain.Entities
{
public class NPC : EntityInterface
{
public uint Id { get; set; }
public Transform Transform { get; set; }
public bool IsHostile { get; set; }
public uint NpcId { get; set; }
public SpoilStateEnum SpoilState { get; set; }
public FullName FullName { get; set; }
public VitalStats VitalStats { get; set; }
public NPC(uint id, Transform transform, bool isHostile, uint npcId, SpoilStateEnum spoilState, FullName fullName, VitalStats vitalStats)
{
Id = id;
Transform = transform;
IsHostile = isHostile;
NpcId = npcId;
SpoilState = spoilState;
FullName = fullName;
VitalStats = vitalStats;
}
}
}

View File

@ -0,0 +1,26 @@
using Client.Domain.Enums;
using Client.Domain.ValueObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Client.Domain.Entities
{
public class Player : EntityInterface
{
public uint Id { get; set; }
public Transform Transform { get; set; }
public FullName FullName { get; set; }
public Phenotype Phenotype { get; set; }
public Player(uint id, Transform transform, FullName fullName, Phenotype phenotype)
{
Id = id;
Transform = transform;
FullName = fullName;
Phenotype = phenotype;
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Client.Domain.Enums
{
public enum SpoilStateEnum
{
None,
Spoiled,
Sweepable
}
}

View File

@ -27,6 +27,12 @@ namespace Client.Infrastructure.Factories
case MessageTypeEnum.Drop:
result = serviceProvider.GetService<EntityHandler<Drop>>();
break;
case MessageTypeEnum.NPC:
result = serviceProvider.GetService<EntityHandler<NPC>>();
break;
case MessageTypeEnum.Player:
result = serviceProvider.GetService<EntityHandler<Player>>();
break;
case MessageTypeEnum.Chat:
result = serviceProvider.GetService<ChatMessageHandler>();
break;