/// avoid map crash private HashSet <IPhysicEvent> calculateAvoidMapCrashEvents(Move currentMove) { HashSet <IPhysicEvent> pEvents = new HashSet <IPhysicEvent> { new MapCrashEvent() }; if (null != moverSelfMapCrashEvent) { pEvents.Add(moverSelfMapCrashEvent.Copy()); } if (null != passageLineEvent) { pEvents.Add(passageLineEvent.Copy()); } PCar physicCar = new PCar(car, game); physicCar.setEnginePower(currentMove.EnginePower); physicCar.setWheelTurn(0);//currentMove.WheelTurn physicCar.setBrake(currentMove.IsBrake); PhysicEventsCalculator.calculateEvents(physicCar, new MoveWithOutChange(), pEvents, calculateAvoidSideCrashEventCheckEnd); return(pEvents); }
private bool calculateTurnMapCrashEventCheckEnd(PCar physicCar, HashSet <IPhysicEvent> pEvents, int tick) { if (tick > maxCheckRotateIterationCount) { return(true); } if (useBrakeForTurn) { physicCar.setBrake(physicCar.Speed.Length > Constant.MinBrakeSpeed); } return(pEvents.ComeContaints(PhysicEventType.PassageLine)); }
private HashSet <IPhysicEvent> calculateTurnMapCrashEvents(PCar iterCar, Vector needDirAngle, bool isBrake) { HashSet <IPhysicEvent> pEvents = new HashSet <IPhysicEvent> { passageLineEvent.Copy() }; if (null != moverSelfMapCrashEvent) { pEvents.Add(moverSelfMapCrashEvent.Copy()); } PCar physicCar = new PCar(iterCar); useBrakeForTurn = isBrake; physicCar.setBrake(isBrake); PhysicEventsCalculator.calculateEvents(physicCar, new MoveToAngleFunction(needDirAngle.Angle), pEvents, calculateTurnMapCrashEventCheckEnd); return(pEvents); }