public void RemoveConnection() { IsConnectedRight = false; TempCar = RightCar.RollingStock; RightCar.LeftCar = null; RightCar = null; CouplerRight.DestroyCouplerConnection(); CouplerPointRight.DestroyPointConnection(); }
public void InitConnection(RSConnection otherCar) { IsConnectedRight = true; RightCar = otherCar; RightCar.LeftCar = this; // this coupler is in connection CouplerRight.MakeCouplerConnection(); CouplerPointRight.MakePointConnection(otherCar); }
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; }
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(); }
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(); }