Ejemplo n.º 1
0
        public Vehicle(string filename, IDriver driver)
        {
            Driver         = driver;
            Driver.Vehicle = this;

            Config = new VehicleFile(filename);

            if (driver is PlayerDriver)
            {
                if (Config.WindscreenMaterial != "none")
                {
                    Config.Funks.Add(new WindscreenFunk(Config.WindscreenMaterial, this));
                }
            }

            _model = new VehicleModel(Config, false);

            Audio = new VehicleAudio(this);

            Chassis = new VehicleChassis(this);

            CActor actor2 = _model.GetActor(Path.GetFileNameWithoutExtension(_model.ModelName));

            if (actor2 != null)
            {
                _deformableModel          = (CDeformableModel)actor2.Model;
                _deformableModel._actor   = Chassis.Actor;
                _deformableModel._carFile = Config;
            }

            _crushSection = Config.CrushSections[1];

            CMaterial crashMat = ResourceCache.GetMaterial(Config.CrashMaterialFiles[0]);

            _vehicleBitsEmitter = new ParticleEmitter(new VehicleBitsParticleSystem(crashMat), 3, Vector3.Zero);
            _vehicleBitsEmitter.DumpsPerSecond = 0.7f;

            DamageSmokeEmitter         = new ParticleEmitter(new DamageSmokeParticleSystem(Color.Gray), 5, Vector3.Zero);
            DamageSmokeEmitter.Enabled = false;

            _flames        = new PixmapBillboard(new Vector2(0.7f, 0.25f), "flames.pix");
            SkidMarkBuffer = new SkidMarkBuffer(this, 150);
        }
Ejemplo n.º 2
0
        public Vehicle(string filename, IDriver driver)
        {
            Driver = driver;
            Driver.Vehicle = this;

            Config = new VehicleFile(filename);

            if (driver is PlayerDriver)
            {
                if (Config.WindscreenMaterial != "none")
                    Config.Funks.Add(new WindscreenFunk(Config.WindscreenMaterial, this));
            }

            _model = new VehicleModel(Config, false);

            Audio = new VehicleAudio(this);

            Chassis = new VehicleChassis(this);

            CActor actor2 = _model.GetActor(Path.GetFileNameWithoutExtension(_model.ModelName));
            if (actor2 != null)
            {
                _deformableModel = (CDeformableModel)actor2.Model;
                _deformableModel._actor = Chassis.Actor;
                _deformableModel._carFile = Config;
            }

            _crushSection = Config.CrushSections[1];

            CMaterial crashMat = ResourceCache.GetMaterial(Config.CrashMaterialFiles[0]);
            _vehicleBitsEmitter = new ParticleEmitter(new VehicleBitsParticleSystem(crashMat), 3, Vector3.Zero);
            _vehicleBitsEmitter.DumpsPerSecond = 0.7f;

            DamageSmokeEmitter = new ParticleEmitter(new DamageSmokeParticleSystem(Color.Gray), 5, Vector3.Zero);
            DamageSmokeEmitter.Enabled = false;

            _flames = new PixmapBillboard(new Vector2(0.7f, 0.25f), "flames.pix");
            SkidMarkBuffer = new SkidMarkBuffer(this, 150);
        }