public void React(ReactionMethod method, IEntity entity, ReagentPrototype reagent, ReagentUnit volume, Solution?source)
        {
            switch (method)
            {
            case ReactionMethod.Touch:
                if (!Touch)
                {
                    return;
                }
                break;

            case ReactionMethod.Injection:
                if (!Injection)
                {
                    return;
                }
                break;

            case ReactionMethod.Ingestion:
                if (!Ingestion)
                {
                    return;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(method), method, null);
            }

            React(entity, reagent, volume, source);
        }
 protected abstract void React(IEntity entity, ReagentPrototype reagent, ReagentUnit volume, Solution?source);
Exemple #3
0
 ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
 {
     return(ReagentUnit.New(MetabolismRate * tickTime));
 }
 /// <summary>
 ///     Constructs a solution containing 100% of a reagent (ex. A beaker of pure water).
 /// </summary>
 /// <param name="reagentId">The prototype ID of the reagent to add.</param>
 /// <param name="quantity">The quantity in milli-units.</param>
 public Solution(string reagentId, ReagentUnit quantity)
 {
     AddReagent(reagentId, quantity);
 }
 public ReagentQuantity(string reagentId, ReagentUnit quantity)
 {
     ReagentId = reagentId;
     Quantity  = quantity;
 }
 public void RemoveAllSolution()
 {
     _contents.Clear();
     TotalVolume = ReagentUnit.New(0);
 }
 void IExposeData.ExposeData(ObjectSerializer serializer)
 {
     serializer.DataField(ref _amount, "amount", ReagentUnit.New(1));
     serializer.DataField(ref _catalyst, "catalyst", false);
 }