private void OnActive(ComponentEntityTuple <Engine.Systems.Activation.Components.Activation, TimedActivation, CurrentLocation> entityTuple) { if (entityTuple.Component3.Value.HasValue && _subsystemMatcher.TryGetMatchingEntity(entityTuple.Component3.Value.Value, out var subsystemTuple)) { var activationTickModifier = (1 - (subsystemTuple.Component2.Value / (decimal)subsystemTuple.Component2.Maximum) * CPURatioScalingFactor); entityTuple.Component2.ActivationTickModifier = RangeHelper.AssignWithinBounds(activationTickModifier, 0, Int32.MaxValue); } }
public void Tick() { foreach (var subsystemTuple in _subsystemMatcher.MatchingEntities) { var sum = subsystemTuple.Component3.Value; foreach (var itemContainer in subsystemTuple.Component2.Items) { ComponentEntityTuple <IItemType, ConsumeMemory> itemTuple; if (itemContainer.Item != null && _itemMatcher.TryGetMatchingEntity(itemContainer.Item.Value, out itemTuple)) { sum += itemTuple.Component2.Value; } } subsystemTuple.Component3.Value = RangeHelper.AssignWithinBounds(sum, 0, subsystemTuple.Component3.Maximum); } }
public void Tick() { foreach (var subsystemTuple in _subsystemMatcher.MatchingEntities) { var sum = subsystemTuple.Component3.Value; foreach (var visitorId in subsystemTuple.Component2.Values) { ComponentEntityTuple <VisitorPosition, ConsumeCPU> visitorTuple; if (_visitorMatcher.TryGetMatchingEntity(visitorId, out visitorTuple)) { sum += visitorTuple.Component2.Value; } } subsystemTuple.Component3.Value = RangeHelper.AssignWithinBounds(sum, 0, subsystemTuple.Component3.Maximum); } }