Example #1
0
 public void RemoveConnection()
 {
     IsConnectedRight = false;
     TempCar          = RightCar.RollingStock;
     RightCar.LeftCar = null;
     RightCar         = null;
     CouplerRight.DestroyCouplerConnection();
     CouplerPointRight.DestroyPointConnection();
 }
Example #2
0
 public void InitConnection(RSConnection otherCar)
 {
     IsConnectedRight = true;
     RightCar         = otherCar;
     RightCar.LeftCar = this;
     // this coupler is in connection
     CouplerRight.MakeCouplerConnection();
     CouplerPointRight.MakePointConnection(otherCar);
 }
Example #3
0
 private void SetCouplers()
 {
     couplers          = GetComponentsInChildren <Coupler> ();
     CouplerLeft       = couplers [0].transform.position.x < couplers [1].transform.position.x ? couplers [0] : couplers [1];
     CouplerRight      = CouplerLeft == couplers [0] ? couplers [1] : couplers [0];
     CouplerPointRight = CouplerRight.GetComponentInChildren <CouplerPoint> ();
     CouplerPointLeft  = CouplerLeft.GetComponentInChildren <CouplerPoint> ();
     //only Right coupler can connect
     CouplerPointRight.IsAbleToConnect = true;
     CouplerPointLeft.IsAbleToConnect  = false;
 }
Example #4
0
 public void DestroyConnection()
 {
     CompositionManager.Instance.UpdateCompositionsAfterUncoupling(RightCar.RollingStock);
     IsConnectedRight = false;
     JustUncoupled    = true;
     TempCar          = RightCar.RollingStock;
     tempDist         = TempCar.OwnRun - RollingStock.OwnRun;
     RightCar.LeftCar = null;
     RightCar         = null;
     CouplerRight.DestroyCouplerConnection();
     CouplerPointRight.DestroyPointConnection();
 }
Example #5
0
 public void MakeConnection(RSConnection otherCar)
 {
     IsConnectedRight = true;
     RightCar         = otherCar;
     RightCar.LeftCar = this;
     // this coupler is in connection
     CouplerRight.MakeCouplerConnection();
     CouplerPointRight.MakePointConnection(otherCar);
     // make new comp from two
     CompositionManager.Instance.UpdateCompositionsAfterCoupling(RollingStock, RightCar.RollingStock);
     //for coupler indication
     EventManager.CarsCoupled();
 }