forked from Shardstone/trail-into-darkness
added more utilty packges
This commit is contained in:
@@ -6,14 +6,14 @@ namespace Nox.Game {
|
||||
|
||||
public interface IPerkFactory {
|
||||
IReadOnlyCollection<PerkDefinition> GetAll();
|
||||
PerkDefinition GetById(PerksIds perkId);
|
||||
PerkDefinition GetById(Guid perkId);
|
||||
IReadOnlyCollection<PerkDefinition> GetPerksFor(CharacterDefinition character);
|
||||
bool TryAddPerk(CharacterDefinition character, PerksIds perkId);
|
||||
bool TryAddPerk(CharacterDefinition character, Guid perkId);
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerkDefinition {
|
||||
public PerksIds id;
|
||||
public Guid id;
|
||||
public string name;
|
||||
public ModifiersData modifiers = new ();
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace Nox.Game {
|
||||
}
|
||||
|
||||
public sealed class PerkFactory : IPerkFactory {
|
||||
private readonly Dictionary<PerksIds, PerkDefinition> perkPool = new ();
|
||||
private readonly Dictionary<Guid, PerkDefinition> perkPool = new ();
|
||||
|
||||
public PerkFactory(PerksRegistry perksRegistry) {
|
||||
if(!perksRegistry) {
|
||||
@@ -40,7 +40,7 @@ namespace Nox.Game {
|
||||
return perkPool.Values.ToList();
|
||||
}
|
||||
|
||||
public PerkDefinition GetById(PerksIds perkId) {
|
||||
public PerkDefinition GetById(Guid perkId) {
|
||||
perkPool.TryGetValue(perkId, out var perk);
|
||||
return perk;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace Nox.Game {
|
||||
return perkPool.Values.Where(p => !ownedPerkIds.Contains(p.id)).ToList();
|
||||
}
|
||||
|
||||
public bool TryAddPerk(CharacterDefinition character, PerksIds perkId) {
|
||||
public bool TryAddPerk(CharacterDefinition character, Guid perkId) {
|
||||
if(character == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user