Exemple #1
0
        /// <summary>
        /// Creates a new train and assigns it to a group.
        /// </summary>
        public Train(TrainGroup group, string _name, int length, TrainContribution _type, TrainController _controller)
            : base(group, _name)
        {
            this.type       = _type;
            this.controller = _controller;

            TrainCarContribution[] carTypes = type.Create(length);

            cars = new TrainCar[length];
            for (int i = 0; i < length; i++)
            {
                cars[i] = new TrainCar(this, carTypes[i], i);
            }

            calcNextTrainCarState = new CalcNextTrainCarState(this);
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 public void OnDeserialization(object sender)
 {
     calcNextTrainCarState = new CalcNextTrainCarState(this);
 }