예제 #1
0
 // for copy
 public FreightAnimationStatic(FreightAnimationStatic freightAnimStatic)
 {
     SubType       = freightAnimStatic.SubType;
     ShapeFileName = freightAnimStatic.ShapeFileName;
     XOffset       = freightAnimStatic.XOffset;
     YOffset       = freightAnimStatic.YOffset;
     ZOffset       = freightAnimStatic.ZOffset;
     Flipped       = freightAnimStatic.Flipped;
     FreightWeight = freightAnimStatic.FreightWeight;
 }
예제 #2
0
        // for copy
        public FreightAnimationStatic(FreightAnimationStatic freightAnimStatic)
        {
            SubType       = freightAnimStatic.SubType;
            ShapeFileName = freightAnimStatic.ShapeFileName;
            XOffset       = freightAnimStatic.XOffset;
            YOffset       = freightAnimStatic.YOffset;
            ZOffset       = freightAnimStatic.ZOffset;
            Flipped       = freightAnimStatic.Flipped;
            FreightWeight = freightAnimStatic.FreightWeight;

            // additions to manage consequences of variable weight on friction and brake forces
            FullStaticORTSDavis_A            = freightAnimStatic.FullStaticORTSDavis_A;
            FullStaticORTSDavis_B            = freightAnimStatic.FullStaticORTSDavis_B;
            FullStaticORTSDavis_C            = freightAnimStatic.FullStaticORTSDavis_C;
            FullStaticORTSWagonFrontalAreaM2 = freightAnimStatic.FullStaticORTSWagonFrontalAreaM2;
            FullStaticORTSDavisDragConstant  = freightAnimStatic.FullStaticORTSDavisDragConstant;
            FullStaticMaxBrakeForceN         = freightAnimStatic.FullStaticMaxBrakeForceN;
            FullStaticMaxHandbrakeForceN     = freightAnimStatic.FullStaticMaxHandbrakeForceN;
            FullStaticCentreOfGravityM_Y     = freightAnimStatic.FullStaticCentreOfGravityM_Y;
        }
예제 #3
0
        public bool StaticFreightAnimationsPresent     = false; // Flag to indicate that a continuous freight animation is present

        public FreightAnimations(STFReader stf, MSTSWagon wagon)
        {
            stf.MustMatch("(");
            bool empty = true;

            stf.ParseBlock(new[] {
                new STFReader.TokenProcessor("mstsfreightanimenabled", () => { MSTSFreightAnimEnabled = stf.ReadBoolBlock(true); }),
                new STFReader.TokenProcessor("wagonemptyweight", () => { WagonEmptyWeight = stf.ReadFloatBlock(STFReader.UNITS.Mass, -1); }),
                new STFReader.TokenProcessor("loadingstartdelay", () => { UnloadingStartDelay = stf.ReadFloatBlock(STFReader.UNITS.None, 0); }),
                new STFReader.TokenProcessor("unloadingstartdelay", () => { UnloadingStartDelay = stf.ReadFloatBlock(STFReader.UNITS.None, 0); }),
                new STFReader.TokenProcessor("isgondola", () => { IsGondola = stf.ReadBoolBlock(false); }),
                // additions to manage consequences of variable weight on friction and brake forces
                new STFReader.TokenProcessor("emptyortsdavis_a", () => { EmptyORTSDavis_A = stf.ReadFloatBlock(STFReader.UNITS.Force, -1); }),
                new STFReader.TokenProcessor("emptyortsdavis_b", () => { EmptyORTSDavis_B = stf.ReadFloatBlock(STFReader.UNITS.Resistance, -1); }),
                new STFReader.TokenProcessor("emptyortsdavis_c", () => { EmptyORTSDavis_C = stf.ReadFloatBlock(STFReader.UNITS.ResistanceDavisC, -1); }),
                new STFReader.TokenProcessor("emptyortswagonfrontalarea", () => { EmptyORTSWagonFrontalAreaM2 = stf.ReadFloatBlock(STFReader.UNITS.AreaDefaultFT2, -1); }),
                new STFReader.TokenProcessor("emptyortsdavisdragconstant", () => { EmptyORTSDavisDragConstant = stf.ReadFloatBlock(STFReader.UNITS.Any, -1); }),
                new STFReader.TokenProcessor("emptymaxbrakeforce", () => { EmptyMaxBrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, -1); }),
                new STFReader.TokenProcessor("emptymaxhandbrakeforce", () => { EmptyMaxHandbrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, -1); }),
                new STFReader.TokenProcessor("emptycentreofgravity_y", () => { EmptyCentreOfGravityM_Y = stf.ReadFloatBlock(STFReader.UNITS.Distance, -1); }),
                new STFReader.TokenProcessor("freightanimcontinuous", () =>
                {
                    Animations.Add(new FreightAnimationContinuous(stf, wagon));
                    FullPhysicsContinuousOne = Animations.Last() as FreightAnimationContinuous;
                    if (wagon.WeightLoadController == null)
                    {
                        wagon.WeightLoadController = new MSTSNotchController(0, 1, 0.01f);
                    }
                    if ((Animations.Last() as FreightAnimationContinuous).FullAtStart)
                    {
                        if (empty)
                        {
                            empty                 = false;
                            FreightType           = wagon.IntakePointList.Last().Type;
                            LoadedOne             = Animations.Last() as FreightAnimationContinuous;
                            FreightWeight        += LoadedOne.FreightWeightWhenFull;
                            LoadedOne.LoadPerCent = 100;
                        }
                        else
                        {
                            (Animations.Last() as FreightAnimationContinuous).FullAtStart = false;
                            Trace.TraceWarning("The wagon can't be full with two different materials, only first is retained");
                        }
                    }
                    ContinuousFreightAnimationsPresent = true;
                }),
                new STFReader.TokenProcessor("freightanimstatic", () =>
                {
                    Animations.Add(new FreightAnimationStatic(stf));
                    StaticFreightWeight           += (Animations.Last() as FreightAnimationStatic).FreightWeight;
                    StaticFreightAnimationsPresent = true;
                    FullPhysicsStaticOne           = Animations.Last() as FreightAnimationStatic;
                }),

/*                new STFReader.TokenProcessor("freightanimdiscrete", ()=>
 *              {
 *                  ORTSFreightAnims.Add(new FreightAnimDiscrete(stf));
 *                  if ((ORTSFreightAnims.Last() as FreightAnimDiscrete).LoadedAtStart)
 *                  {
 *                      if (empty)
 *                      {
 *                          empty = false;
 *                          DiscreteLoadedOne = ORTSFreightAnims.Last() as FreightAnimDiscrete;
 *                          FreightWeight += DiscreteLoadedOne.LoadWeight;
 *                      }
 *                      else
 *                      {
 *                          (ORTSFreightAnims.Last() as FreightAnimContinuous).FullAtStart = false;
 *                          Trace.TraceWarning("The wagon can't be full with two different materials, only first is retained");
 *                      }
 *                  }
 *              }),*/
            });
        }