示例#1
0
 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))));
 }
示例#2
0
        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];
        }
示例#3
0
 private ICoreStatBuilder CreateCoreStatBuilder(
     string identitySuffix, Type dataType, ExplicitRegistrationType explicitRegistrationType)
 => new CoreStatBuilderFromCoreBuilder <Pool>(Pool,
                                              (e, p) => StatFactory.FromIdentity($"{p}{_identitySuffix}.{identitySuffix}", e, dataType,
                                                                                 explicitRegistrationType));
示例#4
0
 protected IDamageRelatedStatBuilder DamageRelatedFromIdentity(
     Type dataType, ExplicitRegistrationType explicitRegistrationType = null,
     [CallerMemberName] string identitySuffix = null)
 => DamageRelatedStatBuilder.Create(StatFactory,
                                    CreateCoreStatBuilder(identitySuffix, dataType, explicitRegistrationType));
示例#5
0
 public override bool Equals(ExplicitRegistrationType other) =>
 other is GainOnAction o &&
示例#6
0
 public override bool Equals(ExplicitRegistrationType other) =>
 other is UserSpecifiedValue o &&
示例#7
0
 protected ICoreStatBuilder CoreStatBuilderFromIdentity(
     string identitySuffix, Type dataType, ExplicitRegistrationType explicitRegistrationType = null)
 => new CoreStatBuilderFromCoreBuilder <string>(Identity,
                                                (e, id) => StatFactory.FromIdentity(id + "." + identitySuffix, e, dataType, explicitRegistrationType));
示例#8
0
 protected IStatBuilder FromIdentity(
     string identitySuffix, Type dataType, ExplicitRegistrationType explicitRegistrationType = null)
 => new StatBuilder(StatFactory,
                    CoreStatBuilderFromIdentity(identitySuffix, dataType, explicitRegistrationType));
示例#9
0
 public static ICoreStatBuilder FromIdentity(
     IStatFactory statFactory, string identity, Type dataType,
     ExplicitRegistrationType explicitRegistrationType = null) =>
 new LeafCoreStatBuilder(
     entity => statFactory.FromIdentity(identity, entity, dataType, explicitRegistrationType));
示例#10
0
 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));