Пример #1
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     Racer   = entity.AddComponent <VehicleRacer>();
     Physics = entity.AddComponent <VehiclePhysics>();
     entity.Bind <VehicleControl>(c => Control = c, _ => Control = null);
     _entity = entity;
 }
Пример #2
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);
        }
Пример #3
0
 public void DisableControl()
 {
     _entity.RemoveComponent <VehicleControl>();
     Control = null;
 }