protected override void Apply(AttributeLoader loader, object wrapperObj)
        {
            if (!(wrapperObj is PowerShuntAttributesWrapper wrapper))
            {
                throw new System.InvalidCastException();
            }

            loader.ApplyPPatch(PowerLevelChargeTimeSeconds, () => wrapper.PowerLevelChargeTimeSeconds, Fixed64.UnsafeFromDouble);
            loader.ApplyPMultPatch(PowerLevelChargeTimeSecondsMult, () => wrapper.PowerLevelChargeTimeSeconds);

            loader.ApplyPPatch(PowerLevelDrainTimeSeconds, () => wrapper.PowerLevelDrainTimeSeconds, Fixed64.UnsafeFromDouble);
            loader.ApplyPMultPatch(PowerLevelDrainTimeSecondsMult, () => wrapper.PowerLevelDrainTimeSeconds);

            loader.ApplyPPatch(HeatThreshold, () => wrapper.HeatThreshold);
            loader.ApplyPMultPatch(HeatThresholdMult, () => wrapper.HeatThreshold);

            loader.ApplyPPatch(CooldownRate, () => wrapper.CooldownRate);
            loader.ApplyPMultPatch(CooldownRateMult, () => wrapper.CooldownRate);

            loader.ApplyPPatch(OverheatDamage, () => wrapper.OverheatDamage);
            loader.ApplyPMultPatch(OverheatDamageMult, () => wrapper.OverheatDamage);

            loader.ApplyPPatch(NearOverheatWarningMargin, () => wrapper.NearOverheatWarningMargin);
            loader.ApplyPMultPatch(NearOverheatWarningMarginMult, () => wrapper.NearOverheatWarningMargin);

            loader.ApplyPPatch(OverheatReminderPeriod, () => wrapper.OverheatReminderPeriod);
            loader.ApplyPMultPatch(OverheatReminderPeriodMult, () => wrapper.OverheatReminderPeriod);

            {
                var l = wrapper.PowerSystems?.Select(x => new PowerSystemAttributesWrapper(x)).ToList() ?? new List <PowerSystemAttributesWrapper>();
                loader.ApplyLPatch(PowerSystems, l, () => new PowerSystemAttributesWrapper(), "PowerSystems");
                wrapper.PowerSystems = l.ToArray();
            }

            if (ReservePowerPool != null)
            {
                InventoryAttributesWrapper inventoryAttributesWrapper = new InventoryAttributesWrapper(wrapper.ReservePowerPool);
                ReservePowerPool.Apply(loader, inventoryAttributesWrapper, null);
                wrapper.ReservePowerPool = inventoryAttributesWrapper;
            }
            if (OverheatingPool != null)
            {
                InventoryAttributesWrapper inventoryAttributesWrapper = new InventoryAttributesWrapper(wrapper.OverheatingPool);
                OverheatingPool.Apply(loader, inventoryAttributesWrapper, null);
                wrapper.OverheatingPool = inventoryAttributesWrapper;
            }
            if (HeatSystem != null)
            {
                InventoryAttributesWrapper inventoryAttributesWrapper = new InventoryAttributesWrapper(wrapper.HeatSystem);
                HeatSystem.Apply(loader, inventoryAttributesWrapper, null);
                wrapper.HeatSystem = inventoryAttributesWrapper;
            }
            if (View != null)
            {
                PowerShuntViewAttributesWrapper powerShuntViewAttributesWrapper = new PowerShuntViewAttributesWrapper(wrapper.View);
                View.Apply(loader, powerShuntViewAttributesWrapper, null);
                wrapper.View = powerShuntViewAttributesWrapper;
            }
        }
示例#2
0
    void Start()
    {
        playerHeat = (HeatSystem)player.GetComponent(typeof(HeatSystem));
        sphere = (SphereCollider)GetComponent(typeof(SphereCollider));
        source = (AudioSource)GetComponent(typeof(AudioSource));
        range = sphere.radius;

        incomingHeat = incomingTime = 0.0f;
    }