Exemplo n.º 1
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="Vehicle"/> class.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="chassis">The rigid body for the chassis.</param>
        /// <remarks>
        /// The car will NOT be automatically enabled! The property <see cref="Enabled"/> needs to be 
        /// set.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="simulation"/> or <paramref name="chassis"/> is <see langword="null"/>.
        /// </exception>
        public Vehicle(Simulation simulation, RigidBody chassis)
        {
            if (simulation == null)
            throw new ArgumentNullException("simulation");
              if (chassis == null)
            throw new ArgumentNullException("chassis");

              Simulation = simulation;
              _chassis = chassis;
              _forceEffect = new VehicleForceEffect(this);

              Wheels = new NotifyingCollection<Wheel>(false, false);
              Wheels.CollectionChanged += OnWheelsChanged;
        }
Exemplo n.º 2
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="Vehicle"/> class.
        /// </summary>
        /// <param name="simulation">The simulation.</param>
        /// <param name="chassis">The rigid body for the chassis.</param>
        /// <remarks>
        /// The car will NOT be automatically enabled! The property <see cref="Enabled"/> needs to be
        /// set.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="simulation"/> or <paramref name="chassis"/> is <see langword="null"/>.
        /// </exception>
        public Vehicle(Simulation simulation, RigidBody chassis)
        {
            if (simulation == null)
            {
                throw new ArgumentNullException("simulation");
            }
            if (chassis == null)
            {
                throw new ArgumentNullException("chassis");
            }

            Simulation   = simulation;
            _chassis     = chassis;
            _forceEffect = new VehicleForceEffect(this);

            Wheels = new NotifyingCollection <Wheel>(false, false);
            Wheels.CollectionChanged += OnWheelsChanged;
        }