Ejemplo n.º 1
0
 public SharedTrain(SharedRailManager manager, RailcarModel engineModel, TrackPosition position, Direction direction = Direction.Forward)
 {
     RailManager = manager;
     manager.Trains.Add(this);
     Railcars  = new List <SharedRailcar>();
     Direction = direction;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Convers a track string to a track position
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="trackString"></param>
        /// <returns></returns>
        public static TrackPosition FromString(SharedRailManager manager, string trackString)
        {
            string[]  parts     = trackString.Split("|");
            TrackNode node      = manager.Nodes[int.Parse(parts[0])];
            Direction direction = (Direction)(int.Parse(parts[1]));
            float     distance  = float.Parse(parts[2]);

            return(new TrackPosition(node, direction, distance));
        }