YI7M5RWLKUG256YXK6CGZKUPDCNHREU2PGV344L2IV24FF5PHG3AC
K4SCXQID5U75KMYJAUGB5DSKWIFGXTRA2B7PIVWR3XMHPJLWZXXAC
HUULCHM5GFGZ7GKLCULFHC333LQ3LBI62VKII3YL5O4C5CDGCT4AC
FQZF2IY4T2F7KEVSHMFID35WNAU55CRRDF6XEXZB7PYZH26UGYPQC
DTKCWM4J7PFNWAAES3RZHQGDA6PTDNX4TZVOXAKF5V7LCZBI3XUAC
MQD6ISMHW27RCHAGJUINEULYXSY3JQ3UKVQPEM5PYDMM32TUYAYQC
CD5FF75KTOBTMVMTMCKMR6F5DFKOF26I5K43ITNHGBI3ZAZHA4RAC
HXTSBPAP75A7EC4RKWYQMVPPHPNZFPHUORBZWDHGEB6MPAGI7G7AC
[SerializeField] Unit<T> _current;
[SerializeField] Unit<T> _capacity;
readonly Unit<T> _minimumCapacity = (Unit<T>)0;
[SerializeField] Unit<TUnit> _current;
[SerializeField] Unit<TUnit> _capacity;
readonly Unit<TUnit> _minimumCapacity = (Unit<TUnit>)0;
public Unit<TUnit> GetCurrent<TResource, TUnit>()
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Current;
}
public Unit<TUnit> SetCurrent<TResource, TUnit>(Unit<TUnit> value)
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Current = value;
}
public Unit<TUnit> GetAdded<TResource, TUnit>()
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Added;
}
public Unit<TUnit> SetAdded<TResource, TUnit>(Unit<TUnit> value)
where TResource : Resource<TUnit>
where TUnit : IUnit
{
return ((IResourceContext<TResource, TUnit>)this).Added = value;
}
((IResourceContext<TResource, TUnit>)context).Current += amount;
Debug.Log($"{_effectName}: {((IResourceContext<TResource, TUnit>)context).Current}");
context.SetCurrent<TResource, TUnit>(context.GetCurrent<TResource, TUnit>() + amount);
Debug.Log($"{_effectName}: {context.GetCurrent<TResource, TUnit>()}");
// public class VarCountResourceEffect<TResource> : IEffect
// where TResource : IResource<IUnit>
// {
// readonly string _effectName = $"Count({typeof(TResource).Name})Effect";
// public void Apply(EffectContext context) {
// Debug.Log($"{_effectName}: Apply");
// var amount = context.GetEffectedUnits()
// .Select(transform => transform.GetComponent<TResource>())
// .Where(resource => resource != null)
// .Select(resource => resource.)
// .Aggregate((Unit<IUnit>)0, (sum, next) => sum += next);
// Unit<IUnit> unit;
// var a = context.VarGetCurrent<TResource>();
// }
// public void Effect(EffectContext context) {
// throw new System.NotImplementedException();
// }
// }
// public class VarCountPainEffect : VarCountResourceEffect<Pain> {}
if (MultiplicativeBeforeFlat) {
((IResourceContext<TResource, TUnit>)context).Added = ((IResourceContext<TResource, TUnit>)context).Added * Multiplicative + Flat;
}
else {
((IResourceContext<TResource, TUnit>)context).Added = (((IResourceContext<TResource, TUnit>)context).Added + Flat) * Multiplicative;
}
Unit<TUnit> newAdded = MultiplicativeBeforeFlat?
context.GetAdded<TResource, TUnit>() * Multiplicative + Flat :
(context.GetAdded<TResource, TUnit>() + Flat) * Multiplicative;
context.SetAdded<TResource, TUnit>(newAdded);
public sealed class AccumulatePainByPainTagEffect : AccumulateResourceByResourceEffect<Pain, PainUnit, Pain, PainUnit> { }
public sealed class AccumulatePainByFatigueTagEffect : AccumulateResourceByResourceEffect<Pain, PainUnit, Fatigue, FatigueUnit> { }
public sealed class AccumulatePainByBlueTagEffect : AccumulateResourceByResourceEffect<Pain, PainUnit, BlueTag, BlueTagUnit> { }
public sealed class AccumulatePainByRedTagEffect : AccumulateResourceByResourceEffect<Pain, PainUnit, RedTag, RedTagUnit> { }
public sealed class AccumulatePainByGreenTagEffect : AccumulateResourceByResourceEffect<Pain, PainUnit, GreenTag, GreenTagUnit> { }
public class AccumulatePainByResource<TResourceBy, TUnitBy> : AccumulateResourceByResourceEffect<Pain, PainUnit, TResourceBy, TUnitBy>
where TResourceBy : Resource<TUnitBy>
where TUnitBy : IUnit { }
public sealed class AccumulatePainByPainTagEffect : AccumulatePainByResource<Pain, PainUnit> { }
public sealed class AccumulatePainByFatigueTagEffect : AccumulatePainByResource<Fatigue, FatigueUnit> { }
public sealed class AccumulatePainByBlueTagEffect : AccumulatePainByResource<BlueTag, BlueTagUnit> { }
public sealed class AccumulatePainByRedTagEffect : AccumulatePainByResource<RedTag, RedTagUnit> { }
public sealed class AccumulatePainByGreenTagEffect : AccumulatePainByResource<GreenTag, GreenTagUnit> { }
public sealed class AccumulateFatigueByPainTagEffect : AccumulateResourceByResourceEffect<Fatigue, FatigueUnit, Pain, PainUnit> { }
public sealed class AccumulateFatigueByFatigueTagEffect : AccumulateResourceByResourceEffect<Fatigue, FatigueUnit, Fatigue, FatigueUnit> { }
public sealed class AccumulateFatigueByBlueTagEffect : AccumulateResourceByResourceEffect<Fatigue, FatigueUnit, BlueTag, BlueTagUnit> { }
public sealed class AccumulateFatigueByRedTagEffect : AccumulateResourceByResourceEffect<Fatigue, FatigueUnit, RedTag, RedTagUnit> { }
public sealed class AccumulateFatigueByGreenTagEffect : AccumulateResourceByResourceEffect<Fatigue, FatigueUnit, GreenTag, GreenTagUnit> { }
public class AccumulateFatigueByResource<TResourceBy, TUnitBy> : AccumulateResourceByResourceEffect<Fatigue, FatigueUnit, TResourceBy, TUnitBy>
where TResourceBy : Resource<TUnitBy>
where TUnitBy : IUnit { }
public sealed class AccumulateFatigueByPainTagEffect : AccumulateFatigueByResource<Pain, PainUnit> { }
public sealed class AccumulateFatigueByFatigueTagEffect : AccumulateFatigueByResource<Fatigue, FatigueUnit> { }
public sealed class AccumulateFatigueByBlueTagEffect : AccumulateFatigueByResource<BlueTag, BlueTagUnit> { }
public sealed class AccumulateFatigueByRedTagEffect : AccumulateFatigueByResource<RedTag, RedTagUnit> { }
public sealed class AccumulateFatigueByGreenTagEffect : AccumulateFatigueByResource<GreenTag, GreenTagUnit> { }
public sealed class AccumulateBlueTagByPainTagEffect : AccumulateResourceByResourceEffect<BlueTag, BlueTagUnit, Pain, PainUnit> { }
public sealed class AccumulateBlueTagByFatigueTagEffect : AccumulateResourceByResourceEffect<BlueTag, BlueTagUnit, Fatigue, FatigueUnit> { }
public sealed class AccumulateBlueTagByBlueTagEffect : AccumulateResourceByResourceEffect<BlueTag, BlueTagUnit, BlueTag, BlueTagUnit> { }
public sealed class AccumulateBlueTagByRedTagEffect : AccumulateResourceByResourceEffect<BlueTag, BlueTagUnit, RedTag, RedTagUnit> { }
public sealed class AccumulateBlueTagByGreenTagEffect : AccumulateResourceByResourceEffect<BlueTag, BlueTagUnit, GreenTag, GreenTagUnit> { }
public class AccumulateBlueTagByResource<TResourceBy, TUnitBy> : AccumulateResourceByResourceEffect<BlueTag, BlueTagUnit, TResourceBy, TUnitBy>
where TResourceBy : Resource<TUnitBy>
where TUnitBy : IUnit { }
public sealed class AccumulateBlueTagByPainTagEffect : AccumulateBlueTagByResource<Pain, PainUnit> { }
public sealed class AccumulateBlueTagByFatigueTagEffect : AccumulateBlueTagByResource<Fatigue, FatigueUnit> { }
public sealed class AccumulateBlueTagByBlueTagEffect : AccumulateBlueTagByResource<BlueTag, BlueTagUnit> { }
public sealed class AccumulateBlueTagByRedTagEffect : AccumulateBlueTagByResource<RedTag, RedTagUnit> { }
public sealed class AccumulateBlueTagByGreenTagEffect : AccumulateBlueTagByResource<GreenTag, GreenTagUnit> { }
public sealed class AccumulateRedTagByPainTagEffect : AccumulateResourceByResourceEffect<RedTag, RedTagUnit, Pain, PainUnit> { }
public sealed class AccumulateRedTagByFatigueEffect : AccumulateResourceByResourceEffect<RedTag, RedTagUnit, Fatigue, FatigueUnit> { }
public sealed class AccumulateRedTagByBlueTagEffect : AccumulateResourceByResourceEffect<RedTag, RedTagUnit, BlueTag, BlueTagUnit> { }
public sealed class AccumulateRedTagByRedTagEffect : AccumulateResourceByResourceEffect<RedTag, RedTagUnit, RedTag, RedTagUnit> { }
public sealed class AccumulateRedTagByGreenTagEffect : AccumulateResourceByResourceEffect<RedTag, RedTagUnit, GreenTag, GreenTagUnit> { }
public class AccumulateRedTagByResource<TResourceBy, TUnitBy> : AccumulateResourceByResourceEffect<RedTag, RedTagUnit, TResourceBy, TUnitBy>
where TResourceBy : Resource<TUnitBy>
where TUnitBy : IUnit { }
public sealed class AccumulateRedTagByPainTagEffect : AccumulateRedTagByResource<Pain, PainUnit> { }
public sealed class AccumulateRedTagByFatigueEffect : AccumulateRedTagByResource<Fatigue, FatigueUnit> { }
public sealed class AccumulateRedTagByBlueTagEffect : AccumulateRedTagByResource<BlueTag, BlueTagUnit> { }
public sealed class AccumulateRedTagByRedTagEffect : AccumulateRedTagByResource<RedTag, RedTagUnit> { }
public sealed class AccumulateRedTagByGreenTagEffect : AccumulateRedTagByResource<GreenTag, GreenTagUnit> { }
public sealed class AccumulateGreenTagByPainTagEffect : AccumulateResourceByResourceEffect<GreenTag, GreenTagUnit, Pain, PainUnit> { }
public sealed class AccumulateGreenTagByFatigueEffect : AccumulateResourceByResourceEffect<GreenTag, GreenTagUnit, Fatigue, FatigueUnit> { }
public sealed class AccumulateGreenTagByBlueTagEffect : AccumulateResourceByResourceEffect<GreenTag, GreenTagUnit, BlueTag, BlueTagUnit> { }
public sealed class AccumulateGreenTagByRedTagEffect : AccumulateResourceByResourceEffect<GreenTag, GreenTagUnit, RedTag, RedTagUnit> { }
public sealed class AccumulateGreenTagByGreenTagEffect : AccumulateResourceByResourceEffect<GreenTag, GreenTagUnit, GreenTag, GreenTagUnit> { }
public class AccumulateGreeTagByResource<TResourceBy, TUnitBy> : AccumulateResourceByResourceEffect<GreenTag, GreenTagUnit, TResourceBy, TUnitBy>
where TResourceBy : Resource<TUnitBy>
where TUnitBy : IUnit { }
public sealed class AccumulateGreenTagByPainTagEffect : AccumulateGreeTagByResource<Pain, PainUnit> { }
public sealed class AccumulateGreenTagByFatigueEffect : AccumulateGreeTagByResource<Fatigue, FatigueUnit> { }
public sealed class AccumulateGreenTagByBlueTagEffect : AccumulateGreeTagByResource<BlueTag, BlueTagUnit> { }
public sealed class AccumulateGreenTagByRedTagEffect : AccumulateGreeTagByResource<RedTag, RedTagUnit> { }
public sealed class AccumulateGreenTagByGreenTagEffect : AccumulateGreeTagByResource<GreenTag, GreenTagUnit> { }