示例#1
0
        /// 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);
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }