コード例 #1
0
ファイル: TransferCar.cs プロジェクト: microm8/Qubiqa-P-G
        public TransferCar(TransferCarInfo info) : base(info)
        {
            transport = new StraightTransportSection(Color.Blue, info.length, 0, 0.1f);
            Add(transport);
            transport.LocalYaw      = (float)Math.PI;
            transport.LocalPosition = new Vector3(transport.Length / 2, 0, 0);
            transport.Visible       = false;

            destination = new ActionPoint();
            transport.Route.InsertActionPoint(destination);
            destination.Distance = transport.Length / 2;
            destination.StopMode = ActionPoint.StoppingMode.Stop;
            destination.OnEnter += DestinationOnEnter;

            car1Transport = new StraightTransportSection(carColor, 1.8f, carHeight, 1.0f);
            Add(car1Transport);
            car1Transport.LocalYaw          = (float)Math.PI / 2;
            car1Transport.Route.Motor.Speed = conveyorSpeed;


            //Z-Position of the rails were modified
            rail1 = new Cube(Color.Gray, transport.Length, 0.1f, 0.1f);
            Add(rail1);
            rail1.LocalPosition = new Vector3(transport.Length / 2, 0, 0.540f);
            rail2 = new Cube(Color.Gray, transport.Length, 0.1f, 0.1f);
            Add(rail2);
            rail2.LocalPosition = new Vector3(transport.Length / 2, 0, -0.540f);

            car = Load.CreateBox(0.1f, 0.1f, 0.1f, Color.Red);
            transport.Route.Add(car);
            car.Deletable = false;
            car.Embedded  = true;
            car.Stop();
            car.OnPositionChanged += Car_OnPositionChanged;
            car.Distance           = destination.Distance;
            car.Visible            = false;

            car1OnBoard          = car1Transport.Route.InsertActionPoint(car1Transport.Length / 2);
            car1OnBoard.OnEnter += Car1OnBoard_OnEnter;

            car1Leaving          = car1Transport.Route.InsertActionPoint(car1Transport.Length);
            car1Leaving.Edge     = ActionPoint.Edges.Trailing;
            car1Leaving.OnEnter += Car1Leaving_OnEnter;
        }