private void PreRender() { touchableObject.Clear(); if (!Loading.SimulationSetup) { return; } if (renderer.Camera.CurrentMode != CameraViewMode.Interior && renderer.Camera.CurrentMode != CameraViewMode.InteriorLookAhead) { return; } CarBase Car = TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar]; int add = Car.CarSections[0].CurrentAdditionalGroup + 1; if (add >= Car.CarSections[0].Groups.Length) { return; } TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements; if (TouchElements == null) { return; } foreach (TouchElement element in TouchElements) { ShowObject(element.Element.internalObject); } }
public override void _Ready() { var carBase = new CarBase(); AddChild(carBase); var carLeftWheel = new Wheel(); carLeftWheel.Position = carBase.Position + new Vector2((-carBase.BodySize.x / 2) + carLeftWheel.Radius, carBase.BodySize.y); AddChild(carLeftWheel); var leftJoint = new PinJoint2D() { NodeA = carBase.GetPath(), NodeB = carLeftWheel.GetPath(), Softness = 0 }; carLeftWheel.AddChild(leftJoint); var carRightWheel = new Wheel(); carRightWheel.Position = carBase.Position + new Vector2((carBase.BodySize.x / 2) - carRightWheel.Radius, carBase.BodySize.y); AddChild(carRightWheel); var rightJoint = new PinJoint2D() { NodeA = carBase.GetPath(), NodeB = carRightWheel.GetPath(), Softness = 0 }; carRightWheel.AddChild(rightJoint); }
public async Task <ActionResult <Car> > Upsert(Guid id, [Bind("Make,Price")] CarBase carBase) { Car car = new Car { Make = carBase.Make, Price = carBase.Price }; if (!CarExists(id)) { car.ID = id; _context.Add(car); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetById), new { id = car.ID }, car)); } Car dbCar = await _context.Cars.FindAsync(id); dbCar.Price = car.Price; dbCar.Make = car.Make; _context.Update(dbCar); await _context.SaveChangesAsync(); return(Ok(dbCar)); }
public Windscreen(int numberOfDrops, double dropLife, CarBase car) { RainDrops = new Raindrop[numberOfDrops]; DropLife = dropLife; currentDrops = 0; Car = car; }
/// <summary>Parses an XML horn node</summary> /// <param name="node">The node to parse</param> /// <param name="car">The car</param> /// <param name="Horn">The horn to apply this node's contents to</param> /// <param name="Position">The default sound position</param> /// <param name="Radius">The default sound radius</param> private void ParseHornNode(XmlNode node, CarBase car, out Horn Horn, Vector3 Position, double Radius) { Horn = new Horn(car); foreach (XmlNode c in node.ChildNodes) { switch (c.Name.ToLowerInvariant()) { case "start": ParseNode(c, out Horn.StartSound, ref Position, Radius); break; case "loop": ParseNode(c, out Horn.LoopSound, ref Position, Radius); break; case "end": case "release": case "stop": ParseNode(c, out Horn.EndSound, ref Position, Radius); break; case "toggle": if (c.InnerText.ToLowerInvariant() == "true" || c.InnerText.ToLowerInvariant() == "1") { Horn.Loop = true; } break; } Horn.SoundPosition = Position; } }
public void onDetect(CarBase _car) { if (isUseable) { _car.stop(gameObject); } }
public Bogie(AbstractTrain train, CarBase car) { baseTrain = train; baseCar = car; CarSections = new CarSection[] { }; FrontAxle = new Axle(TrainManagerBase.currentHost, train, car); RearAxle = new Axle(TrainManagerBase.currentHost, train, car); }
/// <summary>The default constructor</summary> public Horn(CarBase car) { this.StartSound = null; this.LoopSound = null; this.EndSound = null; this.Loop = false; this.baseCar = car; }
//private bool isAllInterActiveOpen = false; ///// <summary> ///// 所有汽车可交互是否已经打开 ///// </summary> //public bool IsAllInterActiveOpen //{ // get // { // return isAllInterActiveOpen; // } // set // { // isAllInterActiveOpen = value; // } //} /// <summary> /// 退出AR时调用,重置所有状态值 /// </summary> public void ResetARValue() { CurrentARCar = null; HasShowARCar = false; HasSpawnARCar = false; //HasShowARControllerUI = false; CanPlaceObject = false; }
public BVEMotorSound(CarBase car, double speedConversionFactor) : base(car) { SpeedConversionFactor = speedConversionFactor; Tables = new BVEMotorSoundTable[4]; for (int j = 0; j < 4; j++) { Tables[j].Entries = new BVEMotorSoundTableEntry[] { }; } }
private void Awake() { Car = GetComponent <CarBase>(); FrontRayResult = new RayTraceResult[FrontRayCount]; for (int i = 0; i < FrontRayCount; i++) { FrontRayResult[i] = new RayTraceResult(); } }
public ICar Create(string car) { if (CarsRegistry.ContainsKey(car)) { CarBase newCar = (CarBase)Activator.CreateInstance(CarsRegistry[car]); return(newCar); } throw new NotSupportedException($"Unknown '{car}'"); }
internal bool MoveCheck(Vector2 Point, out Cursor.Status Status) { if (!Loading.SimulationSetup) { Status = Cursor.Status.Default; return(false); } if (renderer.Camera.CurrentMode != CameraViewMode.Interior && renderer.Camera.CurrentMode != CameraViewMode.InteriorLookAhead) { Status = Cursor.Status.Default; return(false); } Status = Cursor.Status.Default; CarBase Car = TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar]; int add = Car.CarSections[0].CurrentAdditionalGroup + 1; if (add >= Car.CarSections[0].Groups.Length) { return(false); } TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements; if (TouchElements == null) { return(false); } ObjectState pickedObject = renderer.AvailableNewRenderer ? ParseFBO(Point, 5, 5) : RenderSceneSelection(Point, new Vector2(5.0f)); foreach (TouchElement TouchElement in TouchElements.Where(x => x.Element.internalObject == pickedObject)) { foreach (int index in TouchElement.ControlIndices) { switch (Interface.CurrentControls[index].Command) { case Translations.Command.PowerIncrease: case Translations.Command.BrakeIncrease: case Translations.Command.ReverserForward: Status = Cursor.Status.Plus; break; case Translations.Command.PowerDecrease: case Translations.Command.BrakeDecrease: case Translations.Command.ReverserBackward: Status = Cursor.Status.Minus; break; } } } return(pickedObject != null); }
protected void WorkOnHide() { isNitroPressed = false; updateUI = false; _playerCar = null; // HideUiPanel(_uiPanelOld); HideUiPanel(_uiPanelNew); }
private void Init() { car = new CarBase(); pnTrack.Car = car; wheelAngle = 0; throttle = 0; car.Mass = (float)nudMass.Value; car.EnginePower = (float)nudPower.Value; car.Adhesion = (float)nudAdhesion.Value; }
internal void LeaveCheck(Vector2 Point) { if (!Loading.SimulationSetup) { return; } if (renderer.Camera.CurrentMode != CameraViewMode.Interior && renderer.Camera.CurrentMode != CameraViewMode.InteriorLookAhead) { return; } CarBase Car = TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar]; int add = Car.CarSections[0].CurrentAdditionalGroup + 1; if (add >= Car.CarSections[0].Groups.Length) { return; } TouchElement[] TouchElements = Car.CarSections[0].Groups[add].TouchElements; if (TouchElements == null) { return; } ObjectState pickedObject = renderer.AvailableNewRenderer ? ParseFBO(Point, 5, 5) : RenderSceneSelection(Point, new Vector2(5.0f)); foreach (TouchElement TouchElement in TouchElements) { if (TouchElement.Element.internalObject == pickedObject) { Car.CarSections[0].CurrentAdditionalGroup = TouchElement.JumpScreenIndex; Car.ChangeCarSection(CarSectionType.Interior); foreach (var index in TouchElement.SoundIndices.Where(x => x >= 0 && Car.Sounds.Touch != null && x < Car.Sounds.Touch.Length)) { Car.Sounds.Touch[index].Play(TrainManager.PlayerTrain.Cars[TrainManager.PlayerTrain.DriverCar], false); } } // HACK: Normally terminate the command issued once. if (TouchElement.Element.internalObject == pickedObject || (pickedObject != prePickedObject && TouchElement.Element.internalObject == prePickedObject)) { foreach (int index in TouchElement.ControlIndices) { Interface.CurrentControls[index].AnalogState = 0.0; Interface.CurrentControls[index].DigitalState = DigitalControlState.Released; MainLoop.RemoveControlRepeat(index); } } } }
public IHttpActionResult getFreeDrivers(int id) { try { lock (DB) { RideBase ride = DB.RideDb.ToList().Find(x => x.ID == id); List <Driver> drivers = new List <Driver>(); DB.DriverDb.ToList().ForEach(x => { CarBase car = DB.CarDb.ToList().Find(y => y.TaxiCarID == x.CarID); if (ride.CarType == car.CarType || ride.CarType == CarRole.Not_Specified) { if (!DB.RideDb.ToList().Exists(z => z.Status == RideStatus.Accepted && z.TaxiRiderID == id)) { drivers.Add(x); } } }); LocationBase location = DB.LocationDb.ToList().Find(x => x.ID == ride.Location.ID); List <Tuple <double, Driver> > freeDrivers = new List <Tuple <double, Driver> >(); drivers.ForEach(x => { x.Location = DB.LocationDb.ToList().Find(y => y.ID == x.Location.ID); double lentgh = Math.Abs (Math.Sqrt(Math.Pow((location.XCoordinate - x.Location.XCoordinate), 2) + Math.Pow((location.YCoordinate - x.Location.YCoordinate), 2))); freeDrivers.Add(new Tuple <double, Driver>(lentgh, x)); }); freeDrivers = freeDrivers.OrderByDescending(x => x.Item1).ToList(); int driverCount = freeDrivers.Count; drivers = new List <Driver>(); for (int i = 0; i < 5; i++) { if (driverCount == 0) { break; } drivers.Add(freeDrivers[i].Item2); driverCount--; } return(Ok(drivers)); } } catch { return(NotFound()); } }
protected void SetPlayerCarSettings(IGameWindow gameWindow) { _playerCar = _carConstructor.CreatePlayerCar(_playerManager.selectedCar, _playerManager.selectedCar.current_color); Assert.AreNotEqual(null, _playerCar); _playerCar.SetColorInGame(_playerManager.selectedCar.current_color); _playerCar.transform.tag = "Player"; _playerCar.Transform.position = new Vector3(0f, 3f, 2f); _playerManager.PlayerCar = _playerCar; //_playerCar.SetValue_RaceTimer(gameWindow.Get_TextRaceTimer()); }
// protected virtual void OnPlayerFinishClickForVelocity() //{ // byte[] bytesToSend; // using (MemoryStream memStream = new MemoryStream(_rawData.Count * 36)) // { // foreach (var val in _rawData) // { // memStream.Write(BitConverter.GetBytes(val.MoveParam.x), 0, 4); // memStream.Write(BitConverter.GetBytes(val.MoveParam.y), 0, 4); // memStream.Write(BitConverter.GetBytes(val.MoveParam.z), 0, 4); // memStream.Write(BitConverter.GetBytes(val.VelocityParam.x), 0, 4); // memStream.Write(BitConverter.GetBytes(val.VelocityParam.y), 0, 4); // memStream.Write(BitConverter.GetBytes(val.VelocityParam.z), 0, 4); // memStream.Write(BitConverter.GetBytes(val.AngularVelocityParam.x), 0, 4); // memStream.Write(BitConverter.GetBytes(val.AngularVelocityParam.y), 0, 4); // memStream.Write(BitConverter.GetBytes(val.AngularVelocityParam.z), 0, 4); // } // bytesToSend = memStream.GetBuffer(); // } // if (bytesToSend != null) // { // _gameData.recordData = Convert.ToBase64String(bytesToSend); // } // _gameManager.Finish(); //} //protected virtual void OnPlayerFinishClickForInput() //{ // byte[] bytesToSend; // using (MemoryStream memStream = new MemoryStream(InputData.Count * 36)) // { // foreach (var val in InputData) // { // memStream.Write(BitConverter.GetBytes(val.steerInput), 0, 4); // memStream.Write(BitConverter.GetBytes(val.throttleInput), 0, 4); // memStream.Write(BitConverter.GetBytes(val.brakeInput), 0, 4); // memStream.Write(BitConverter.GetBytes(val.handbrakeInput), 0, 4); // memStream.Write(BitConverter.GetBytes(val.NitroPower), 0, 4); // memStream.Write(BitConverter.GetBytes(val.RotateAndroid), 0, 4); // memStream.Write(BitConverter.GetBytes(val.Sin), 0, 8); // memStream.Write(BitConverter.GetBytes(val.Cos), 0, 8); // } // bytesToSend = memStream.GetBuffer(); // } // if (bytesToSend != null) // { // _gameData.recordData = Convert.ToBase64String(bytesToSend); // } // _gameManager.Finish(); //} protected void SetShadowCarSettings() { _ghostCar = _carConstructor.CreateEnemyCar(_playerManager.selectedCar, _playerManager.selectedCar.current_color); Assert.AreNotEqual(null, _ghostCar); //_shadowCar.transform.tag = "Player"; _ghostCar.SetColorInGame(_playerManager.selectedCar.current_color); _ghostCar.Transform.position = new Vector3(0f, 3f, -2f); _ghostCar.controller.isEnemy = false; _ghostCar.controller.enabled = false; }
public Horn(SoundBuffer startSound, SoundBuffer loopSound, SoundBuffer endSound, bool loop, CarBase car) { this.Source = null; this.StartSound = startSound; this.LoopSound = loopSound; this.EndSound = endSound; this.Loop = loop; this.StartEndSounds = false; this.LoopStarted = false; this.SoundPosition = new Vector3(); this.baseCar = car; }
private static void Cast(object obj) { try { CarBase m3 = (M3)obj; Console.WriteLine("M3 retuned {0}", m3); } catch (InvalidCastException) { Console.WriteLine("InvalidCastException"); } }
/// <summary> /// runnning a car by catType /// </summary> /// <param name="carType">car</param> /// <returns>if catType found return true, else return false.</returns> public static bool RunCar(string carType) { CarBase car = CarFactory.getCar(carType); if (car is null) { return(false); } car.Run(); return(true); }
public void SellCar(CarBase car) { if (car == null) { throw new ArgumentException("Car is null!"); } if (!_cars.Contains(car)) { throw new ArgumentException("Car not found!"); } _cars.ToList().Remove(car); }
public async Task <ActionResult <Car> > CreateAsync([Bind("Make,Price")] CarBase carBase) { Car car = new Car { Make = carBase.Make, Price = carBase.Price }; _context.Add(car); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetById), new { id = car.ID }, car)); }
public BVEMotorSound(CarBase car, double speedConversionFactor, BVEMotorSoundTable[] tables) : base(car) { SpeedConversionFactor = speedConversionFactor; Tables = new BVEMotorSoundTable[4]; for (int j = 0; j < 4; j++) { Tables[j].Entries = new BVEMotorSoundTableEntry[tables[j].Entries.Length]; for (int k = 0; k < tables[j].Entries.Length; k++) { Tables[j].Entries[k] = tables[j].Entries[k]; } } }
internal Train(TrainState state) { State = state; Destination = Interface.CurrentOptions.InitialDestination; Station = -1; RouteLimits = new double[] { double.PositiveInfinity }; CurrentRouteLimit = double.PositiveInfinity; CurrentSectionLimit = double.PositiveInfinity; Cars = new CarBase[] { }; Specs.DoorOpenMode = DoorMode.AutomaticManualOverride; Specs.DoorCloseMode = DoorMode.AutomaticManualOverride; }
// INTERFACES public void SetValue_PlayerCar() { // pre-condition Assert.AreNotEqual(null, _playerManager.PlayerCar); _playerCar = _playerManager.PlayerCar; EventManager._init.Game.CarEvent.Player.GetEvent.Crash += CheckExplGold; for (int i = 0; i < _playerCar.smokeParticles.Count; i++) { _playerCar.smokeParticles[i].emissionRate = 40; } Assert.AreNotEqual(null, _playerCar); // }
public IHttpActionResult getNewRides() { lock (DB) { Driver d = DB.DriverDb.ToList().Find(x => x.Username == AuthUser.Username); CarBase car = DB.CarDb.ToList().Find(x => x.TaxiCarID == d.CarID); List <RideBase> result = DB.RideDb.ToList().Where(p => p.Status == RideStatus.Created && (car.CarType == p.CarType || p.CarType == CarRole.Not_Specified)).ToList(); result.ForEach(ride => { ride.Location = DB.LocationDb.ToList().Find(l => l.ID == ride.Location.ID); ride.Destination = DB.LocationDb.ToList().Find(p => p.ID == ride.Destination.ID); }); return(Ok(result)); } }
public CarReAdhesionDevice(CarBase car, ReadhesionDeviceType type) { this.Car = car; this.DeviceType = type; this.MaximumAccelerationOutput = Double.PositiveInfinity; this.ApplicationFactor = 0.0; if (Car.Specs.IsMotorCar) { switch (type) { case ReadhesionDeviceType.TypeA: UpdateInterval = 1.0; ApplicationFactor = 0.0; ReleaseInterval = 1.0; ReleaseFactor = 8.0; break; case ReadhesionDeviceType.TypeB: UpdateInterval = 0.1; ApplicationFactor = 0.9935; ReleaseInterval = 4.0; ReleaseFactor = 1.125; break; case ReadhesionDeviceType.TypeC: UpdateInterval = 0.1; ApplicationFactor = 0.965; ReleaseInterval = 2.0; ReleaseFactor = 1.5; break; case ReadhesionDeviceType.TypeD: UpdateInterval = 0.05; ApplicationFactor = 0.935; ReleaseInterval = 0.3; ReleaseFactor = 2.0; break; default: UpdateInterval = 1.0; ApplicationFactor = 1.0; ReleaseInterval = 1.0; ReleaseFactor = 99.0; break; } } }
public Coupler(double minimumDistance, double maximumDistance, CarBase frontCar, CarBase rearCar, AbstractTrain train) { MinimumDistanceBetweenCars = minimumDistance; MaximumDistanceBetweenCars = maximumDistance; baseCar = frontCar; if (rearCar != null) { connectedCar = rearCar; } else { connectedCar = frontCar; } CarSections = new CarSection[] { }; baseTrain = train; }