protected IStatBuilder FromIdentity( Type dataType, ExplicitRegistrationType explicitRegistrationType = null, [CallerMemberName] string identitySuffix = null) { return(new StatBuilder(StatFactory, new CoreStatBuilderFromCoreBuilder <Pool>(Pool, (e, p) => StatFactory.FromIdentity($"{p}{_identitySuffix}.{identitySuffix}", e, dataType, explicitRegistrationType)))); }
public Stat(string identity, Entity entity = default, Type dataType = null, ExplicitRegistrationType explicitRegistrationType = null, IReadOnlyList <Behavior> behaviors = null) { if (!IsDataTypeValid(dataType)) { throw new ArgumentException($"Stats only support double, int, bool or enum data types, {dataType} given", nameof(dataType)); } Identity = identity; Entity = entity; ExplicitRegistrationType = explicitRegistrationType; DataType = dataType ?? typeof(double); _hasRange = NumericTypes.Contains(DataType); Behaviors = behaviors ?? new Behavior[0]; }
private ICoreStatBuilder CreateCoreStatBuilder( string identitySuffix, Type dataType, ExplicitRegistrationType explicitRegistrationType) => new CoreStatBuilderFromCoreBuilder <Pool>(Pool, (e, p) => StatFactory.FromIdentity($"{p}{_identitySuffix}.{identitySuffix}", e, dataType, explicitRegistrationType));
protected IDamageRelatedStatBuilder DamageRelatedFromIdentity( Type dataType, ExplicitRegistrationType explicitRegistrationType = null, [CallerMemberName] string identitySuffix = null) => DamageRelatedStatBuilder.Create(StatFactory, CreateCoreStatBuilder(identitySuffix, dataType, explicitRegistrationType));
public override bool Equals(ExplicitRegistrationType other) => other is GainOnAction o &&
public override bool Equals(ExplicitRegistrationType other) => other is UserSpecifiedValue o &&
protected ICoreStatBuilder CoreStatBuilderFromIdentity( string identitySuffix, Type dataType, ExplicitRegistrationType explicitRegistrationType = null) => new CoreStatBuilderFromCoreBuilder <string>(Identity, (e, id) => StatFactory.FromIdentity(id + "." + identitySuffix, e, dataType, explicitRegistrationType));
protected IStatBuilder FromIdentity( string identitySuffix, Type dataType, ExplicitRegistrationType explicitRegistrationType = null) => new StatBuilder(StatFactory, CoreStatBuilderFromIdentity(identitySuffix, dataType, explicitRegistrationType));
public static ICoreStatBuilder FromIdentity( IStatFactory statFactory, string identity, Type dataType, ExplicitRegistrationType explicitRegistrationType = null) => new LeafCoreStatBuilder( entity => statFactory.FromIdentity(identity, entity, dataType, explicitRegistrationType));
public Stat(string identity, Entity entity = default, Type dataType = null, ExplicitRegistrationType explicitRegistrationType = null, IReadOnlyList <Behavior> behaviors = null) : this(identity, entity, dataType, explicitRegistrationType, behaviors, null) { }
public static IConditionBuilder ConditionFromIdentity( IStatFactory statFactory, string identity, ExplicitRegistrationType explicitRegistrationType = null) => FromIdentity(statFactory, identity, typeof(bool), explicitRegistrationType).IsSet;
private IStatBuilder FromIdentity( string identity, Type dataType, ExplicitRegistrationType explicitRegistrationType = null) => With(LeafCoreStatBuilder.FromIdentity(StatFactory, identity, dataType, explicitRegistrationType));