public void ApplyUnitMovementAttributesPatch(UnitMovementAttributesPatch unitMovementAttributesPatch, UnitMovementAttributesWrapper unitMovementAttributesWrapper) { applyPropertyPatch(unitMovementAttributesPatch.DriveType, () => unitMovementAttributesWrapper.DriveType); if (unitMovementAttributesPatch.Dynamics != null) { using (logger.BeginScope($"UnitDynamicsAttributes:")) { var unitDynamicsAttributesWrapper = new UnitDynamicsAttributesWrapper(unitMovementAttributesWrapper.Dynamics); ApplyUnitDynamicsAttributesPatch(unitMovementAttributesPatch.Dynamics, unitDynamicsAttributesWrapper); unitMovementAttributesWrapper.Dynamics = unitDynamicsAttributesWrapper; } } }
private void ApplyUnitDynamicsAttributesPatch(UnitDynamicsAttributesPatch unitDynamicsAttributesPatch, UnitDynamicsAttributesWrapper unitDynamicsAttributesWrapper) { applyPropertyPatch(unitDynamicsAttributesPatch.DriveType, () => unitDynamicsAttributesWrapper.DriveType); applyPropertyPatch(unitDynamicsAttributesPatch.Length, () => unitDynamicsAttributesWrapper.Length, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.Width, () => unitDynamicsAttributesWrapper.Width, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.MaxSpeed, () => unitDynamicsAttributesWrapper.MaxSpeed, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.ReverseFactor, () => unitDynamicsAttributesWrapper.ReverseFactor, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.AccelerationTime, () => unitDynamicsAttributesWrapper.AccelerationTime, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.BrakingTime, () => unitDynamicsAttributesWrapper.BrakingTime, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.MaxSpeedTurnRadius, () => unitDynamicsAttributesWrapper.MaxSpeedTurnRadius, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.MaxEaseIntoTurnTime, () => unitDynamicsAttributesWrapper.MaxEaseIntoTurnTime, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.DriftType, () => unitDynamicsAttributesWrapper.DriftType, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.ReverseDriftMultiplier, () => unitDynamicsAttributesWrapper.ReverseDriftMultiplier, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.DriftOvershootFactor, () => unitDynamicsAttributesWrapper.DriftOvershootFactor, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.FishTailingTimeIntervals, () => unitDynamicsAttributesWrapper.FishTailingTimeIntervals, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.FishTailControlRecover, () => unitDynamicsAttributesWrapper.FishTailControlRecover, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.MinDriftSlipSpeed, () => unitDynamicsAttributesWrapper.MinDriftSlipSpeed, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.MaxDriftRecoverTime, () => unitDynamicsAttributesWrapper.MaxDriftRecoverTime, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.MinCruiseSpeed, () => unitDynamicsAttributesWrapper.MinCruiseSpeed, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.DeathDriftTime, () => unitDynamicsAttributesWrapper.DeathDriftTime, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitDynamicsAttributesPatch.PermanentlyImmobile, () => unitDynamicsAttributesWrapper.PermanentlyImmobile); }
protected override void Apply(AttributeLoader loader, object wrapperObj) { if (!(wrapperObj is UnitMovementAttributesWrapper wrapper)) { throw new System.InvalidCastException(); } loader.ApplyPPatch(DriveType, () => wrapper.DriveType); if (Dynamics != null) { using (loader.logger.BeginScope($"Dynamics:")) { var w = new UnitDynamicsAttributesWrapper(wrapper.Dynamics); Dynamics.Apply(loader, w, null); wrapper.Dynamics = w; } } if (RandomDynamicsVariance != null) { using (loader.logger.BeginScope($"RandomDynamicsVariance:")) { var w2 = new UnitDynamicsRandomizationParametersWrapper(wrapper.RandomDynamicsVariance); RandomDynamicsVariance.Apply(loader, w2, null); wrapper.RandomDynamicsVariance = w2; } } if (Maneuvers != null) { using (loader.logger.BeginScope($"Maneuvers:")) { var w2 = new UnitManeuverAttributesWrapper(wrapper.Maneuvers); Maneuvers.Apply(loader, w2, null); wrapper.Maneuvers = w2; } } if (Hover != null) { using (loader.logger.BeginScope($"Hover:")) { var w2 = new HoverDynamicsAttributesWrapper(wrapper.Hover); Hover.Apply(loader, w2, null); wrapper.Hover = w2; } } if (Combat != null) { using (loader.logger.BeginScope($"Combat:")) { var w2 = new UnitCombatBehaviorAttributesWrapper(wrapper.Combat); Combat.Apply(loader, w2, null); wrapper.Combat = w2; } } if (Avoidance != null) { using (loader.logger.BeginScope($"Avoidance:")) { var w2 = new UnitAvoidanceAttributesWrapper(wrapper.Avoidance); Avoidance.Apply(loader, w2, null); wrapper.Avoidance = w2; } } if (ReversePolarity != null) { using (loader.logger.BeginScope($"ReversePolarity:")) { var w2 = new ReversePolarityAttributesWrapper(wrapper.ReversePolarity); ReversePolarity.Apply(loader, w2, null); wrapper.ReversePolarity = w2; } } }