Esempio n. 1
0
        public static void ApplyConfig(VehicleBehavior beh, VehicleConfig cfg)
        {
            /* TODO: maybe
             * if (cfg.BodyLength > 0.0)
             *  ph.BodyLength = cfg.BodyLength;
             * if (cfg.BodyWidth > 0.0)
             *  ph.BodyWidth = cfg.BodyWidth;
             * if (cfg.DistanceBetweenAxles > 0.0)
             *  ph.DistanceBetweenAxles = cfg.DistanceBetweenAxles;
             */
            VehiclePhysics ph = beh.Physics;

            ph.BodyMass             = cfg.BodyMass;
            ph.BodyAerodynamics     = cfg.BodyAerodynamics;
            ph.HardImpactLossFactor = cfg.HardImpactLossFactor;
            ph.SoftImpactLossFactor = cfg.SoftImpactLossFactor;
            ph.EngineMaxPower       = cfg.EngineMaxPower;
            ph.StillTurningVelocity = cfg.StillTurningVelocity;
            ph.DriftVelocityFactor  = cfg.DriftVelocityFactor;
            VehicleControl ui = beh.Control;

            ui.SteeringAngle = MathHelper.DegreesToRadians(cfg.UISteeringAngle);
        }
Esempio n. 2
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     entity.Bind <VehiclePhysics>(c => { _veh = c; }, _ => { _veh = null; });
 }