feat: add npc and players
This commit is contained in:
parent
340e91b325
commit
4778f1c478
@ -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();
|
||||
|
32
Client/Domain/Entities/NPC.cs
Normal file
32
Client/Domain/Entities/NPC.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
26
Client/Domain/Entities/Player.cs
Normal file
26
Client/Domain/Entities/Player.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
15
Client/Domain/Enums/SpoilStateEnum.cs
Normal file
15
Client/Domain/Enums/SpoilStateEnum.cs
Normal 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
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user