Files
trail-into-darkness/Assets/Code/GameState/Entities/CharacterAttributesFactory.cs

25 lines
871 B
C#

using System;
using System.Linq;
namespace Nox.Game {
public interface ICharacterAttributesFactory {
EntityAttributes Create(EntityAttributes entityAttributes);
}
public sealed class CharacterAttributesFactory : ICharacterAttributesFactory {
private readonly CharacterRegistry characterRegistry;
public CharacterAttributesFactory(CharacterRegistry characterRegistry) {
this.characterRegistry = characterRegistry;
}
public EntityAttributes Create(EntityAttributes entityAttributes) {
if(entityAttributes.attributes.All(a => a.value != 0)) {
throw new ArgumentOutOfRangeException( "attributes cannot be zero or negative.", new ArgumentException() );
}
//TODO: Handle attributes modifiers and perks
return entityAttributes;
}
}
}