Beispiel #1
0
        public void setupPassageLine(Vector pos, Vector dir, double accuracity)
        {
            double oneLineSize = (game.TrackTileSize - 2 * game.TrackTileMargin) / 4;

            passageLineEvent = new PassageLineEvent(dir, pos, accuracity * oneLineSize);
            outLineEvent     = new OutLineEvent(dir, pos, accuracity * oneLineSize);
        }
Beispiel #2
0
        /// Move to Additional Point
        private void moveToAdditionalPoint(double needAngle)
        {
            if (null == additionalPoints)
            {
                return;
            }

            int minTicks = int.MaxValue;

            foreach (Tuple <Vector, double> data in additionalPoints)
            {
                Vector point = data.Item1;

                IPhysicEvent           passageLineEvent = new PassageLineEvent(Vector.sincos(needAngle), point, 0);
                HashSet <IPhysicEvent> pEvents          = new HashSet <IPhysicEvent> {
                    new MapCrashEvent(),
                    passageLineEvent
                };

                if (null != moverSelfMapCrashEvent)
                {
                    pEvents.Add(moverSelfMapCrashEvent.Copy());
                }

                PCar physicCar = new PCar(car, game);
                PhysicEventsCalculator.calculateEvents(physicCar, new MoveToPoint(point, needAngle), pEvents, moveToAddPointEventCheckEnd);

                if (pEvents.ComeContaints(PhysicEventType.MapCrash) || pEvents.ComeContaints(PhysicEventType.ObjectsCrash) ||
                    !pEvents.ComeContaints(PhysicEventType.PassageLine))
                {
                    continue;
                }

                if (passageLineEvent.CarCome.Pos.GetDistanceTo(point) > data.Item2)
                {
                    continue;
                }

                if (passageLineEvent.TickCome < minTicks)
                {
                    needPos = point;
                }
            }
        }