示例#1
0
文件: Car.cs 项目: sxtgyrq/VRPGame
 public AnimateData2(Data.PathStartPoint2 _start, List <int> _animateData, DateTime _recordTime, bool _isParking)
 {
     this.start       = _start;
     this.animateData = _animateData;
     this.recordTime  = _recordTime;
     this.isParking   = _isParking;
 }
示例#2
0
        private void ReturnToSelf(RoleInGame player, Car car, returnning cmp, ref List <string> notifyMsg)
        {
            var speed  = car.ability.Speed;
            int startT = 0;
            var result = new List <int>();
            //RoleInGame boss = cmp.returningOjb.Boss;
            //  that.getStartPositon(Program.dt.GetFpByIndex(cmp.target), (boss.positionInStation + 1) % 5, ref startT);
            var boss = cmp.returningOjb.Boss;

            // Program.dt.GetAFromBPoint(cmp.returningOjb.returnToSelfAddrPath, Program.dt.GetFpByIndex(cmp.target), speed, ref result, ref startT, player.improvementRecord.speedValue > 0);

            if (cmp.returningOjb.returnToSelfAddrPath.path.Count > 0)
            {
                Program.dt.GetAFromBPoint(cmp.returningOjb.returnToSelfAddrPath.path[0].path, cmp.returningOjb.returnToSelfAddrPath.path[0].position, speed, ref result, ref startT, player.improvementRecord.speedValue > 0);
            }
            var self = player;

            //  that.getEndPositon(Program.dt.GetFpByIndex(self.StartFPIndex), self.positionInStation, ref result, ref startT, player.improvementRecord.speedValue > 0);
            // result.RemoveAll(item => item.t == 0);

            car.setState(that._Players[cmp.key], ref notifyMsg, CarState.returning);
            car.targetFpIndex = self.StartFPIndex;

            Data.PathStartPoint2 startPosition;
            if (cmp.returningOjb.returnToSelfAddrPath.path.Count == 0)
            {
                //that.getStartPositionByFp(out startPosition, cmp.returningOjb.returnToSelfAddrPath.path[0].position);
                // that.getStartPositionByFp(out startPosition, Program.dt.GetFpByIndex(player.StartFPIndex));
                var    fp = Program.dt.GetFpByIndex(player.StartFPIndex);
                double x, y;
                CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fp.positionLongitudeOnRoad, fp.positionLatitudeOnRoad, out x, out y);
                startPosition = new Data.PathStartPoint2()
                {
                    x = Convert.ToInt32(x * 256),
                    y = Convert.ToInt32(y * 256)
                };
            }
            else
            {
                that.getStartPositionByGoPath(out startPosition, cmp.returningOjb.returnToSelfAddrPath.path[0]);
            }
            car.setState(player, ref notifyMsg, CarState.returning);
            car.setAnimateData(player, ref notifyMsg,
                               new AnimateData2(startPosition, result, DateTime.Now, false));
            car.setState(player, ref notifyMsg, CarState.returning);
            this.StartArriavalThread(startT, 0, player, car, cmp.returningOjb.returnToSelfAddrPath,
                                     (newStartT) =>
            {
                this.startNewThread(newStartT, new commandWithTime.comeBack()
                {
                    c = "comeBack",
                    //car = cmp.car,
                    key = cmp.key
                }, this);
            }, player);
        }
示例#3
0
文件: Path.cs 项目: sxtgyrq/VRPGame
        void getStartPositionByFp(out Data.PathStartPoint2 startPosition, FastonPosition fastonPosition)
        {
            double startX, startY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fastonPosition.positionLongitudeOnRoad, fastonPosition.positionLatitudeOnRoad, out startX, out startY);
            startPosition = new Data.PathStartPoint2()
            {
                x = Convert.ToInt32(startX * 256),
                y = Convert.ToInt32(startY * 256)
            };
        }
示例#4
0
文件: Path.cs 项目: sxtgyrq/VRPGame
        internal void getStartPositionByFp(out Data.PathStartPoint2 startPosition, MapGo.nyrqPosition position)
        {
            double startX, startY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(position.BDlongitude, position.BDlatitude, out startX, out startY);
            startPosition = new Data.PathStartPoint2()
            {
                x = Convert.ToInt32(startX * 256),
                y = Convert.ToInt32(startY * 256)
            };
        }
示例#5
0
        private void getStartPositionByFp(out Data.PathStartPoint2 startPosition, Model.FastonPosition fp1)
        {
            double startX, startY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fp1.Longitude, fp1.Latitde, out startX, out startY);
            startPosition = new Data.PathStartPoint2()
            {
                x = Convert.ToInt32(startX * 256),
                y = Convert.ToInt32(startY * 256)
            };
        }
示例#6
0
        private void getStartPositionByGoPath(out Data.PathStartPoint2 startPosition, List <Model.MapGo.nyrqPosition> goPath)
        {
            var    firstPosition = goPath.First();
            double startX, startY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(firstPosition.BDlongitude, firstPosition.BDlatitude, out startX, out startY);
            startPosition = new Data.PathStartPoint2()
            {
                x = Convert.ToInt32(startX * 256),
                y = Convert.ToInt32(startY * 256)
            };
        }
示例#7
0
文件: Path.cs 项目: sxtgyrq/VRPGame
        //public void getStartPositionByGoPath(out Data.PathStartPoint2 startPosition, List<Model.MapGo.nyrqPosition> goPath)
        //{
        //    var firstPosition = goPath.First();
        //    double startX, startY;
        //    CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(firstPosition.BDlongitude, firstPosition.BDlatitude, out startX, out startY);
        //    startPosition = new Data.PathStartPoint2()
        //    {
        //        x = Convert.ToInt32(startX * 256),
        //        y = Convert.ToInt32(startY * 256)
        //    };
        //}
        internal void getStartPositionByGoPath(out Data.PathStartPoint2 startPosition, Node.pathItem pathItem)
        {
            double startX, startY;

            if (pathItem.path.Count > 0)
            {
                CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(pathItem.path[0].BDlongitude, pathItem.path[0].BDlatitude, out startX, out startY);
            }
            else
            {
                CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(pathItem.position.BDlongitude, pathItem.position.BDlatitude, out startX, out startY);
            }
            startPosition = new Data.PathStartPoint2()
            {
                x = Convert.ToInt32(startX * 256),
                y = Convert.ToInt32(startY * 256)
            };
        }
示例#8
0
文件: Path.cs 项目: sxtgyrq/VRPGame
        /// <summary>
        /// 获取从基地出来时的路径!
        /// </summary>
        /// <param name="fp">初始地点</param>
        /// <param name="car">carA?-carE</param>
        /// <param name="startTInput">时间</param>
        /// <returns></returns>
        public List <int> getStartPositon(Model.FastonPosition fp, int positionInStation, ref int startTInput, out Data.PathStartPoint2 startPosition, bool speedImproved)
        {
            double startX, startY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fp.Longitude, fp.Latitde, out startX, out startY);
            int startT0;// startT1;

            double endX, endY;

            CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fp.positionLongitudeOnRoad, fp.positionLatitudeOnRoad, out endX, out endY);
            int endT0;// endT1;

            //这里要考虑前台坐标系(左手坐标系)。
            var cc = new Complex(endX - startX, (-endY) - (-startY));

            cc = ToOne(cc);

            var     positon1 = cc * (new Complex(-0.309016994, 0.951056516));
            var     positon2 = positon1 * (new Complex(0.809016994, 0.587785252));
            var     positon3 = positon2 * (new Complex(0.809016994, 0.587785252));
            var     positon4 = positon3 * (new Complex(0.809016994, 0.587785252));
            var     positon5 = positon4 * (new Complex(0.809016994, 0.587785252));
            Complex position;

            switch (positionInStation)
            {
            case 0:
            {
                position = positon1;
            }; break;

            case 1:
            {
                position = positon2;
            }; break;

            case 2:
            {
                position = positon3;
            }; break;

            case 3:
            {
                position = positon4;
            }; break;

            case 4:
            {
                position = positon5;
            }; break;

            default:
            {
                position = positon1;
            }; break;
            }
            var    percentOfPosition = 0.25;
            double carPositionX      = startX + position.Real * percentOfPosition;
            double carPositionY      = startY - position.Imaginary * percentOfPosition;

            startPosition = new Data.PathStartPoint2()
            {
                x = Convert.ToInt32(carPositionX * 256),
                y = Convert.ToInt32(carPositionY * 256)
            };

            List <int> animateResult = new List <int>();

            startT0      = startTInput;
            endT0        = startT0 + this.magicE.shotTime(500, speedImproved);
            startTInput += this.magicE.shotTime(500, speedImproved);
            var animate1 = new Data.PathResult3()
            {
                x = Convert.ToInt32(-(position.Real * percentOfPosition) * 256),
                y = Convert.ToInt32(position.Imaginary * percentOfPosition * 256),
                t = endT0 - startT0
            };

            //var animate1 = new Data.PathResult()
            //{
            //    t0 = startT0,
            //    x0 = carPositionX,
            //    y0 = carPositionY,
            //    t1 = endT0,
            //    x1 = startX,
            //    y1 = startY
            //};
            if (animate1.t != 0)
            {
                animateResult.Add(animate1.x);
                animateResult.Add(animate1.y);
                animateResult.Add(animate1.t);
            }
            // animateResult.Add(animate1);

            /*
             * 上道路的速度为10m/s 即36km/h
             */
            var interview = Convert.ToInt32(CommonClass.Geography.getLengthOfTwoPoint.GetDistance(fp.Latitde, fp.Longitude, fp.positionLatitudeOnRoad, fp.positionLongitudeOnRoad) / 10 * 1000);

            interview = this.magicE.shotTime(interview, speedImproved);

            //startT1 = startTInput;
            //endT1 = startT1 + interview;
            startTInput += interview;

            var animate2 = new Data.PathResult3()
            {
                x = Convert.ToInt32((endX - startX) * 256),
                y = Convert.ToInt32((endY - startY) * 256),
                t = interview
            };

            //var animate2 = new Data.PathResult()
            //{
            //    t0 = startT1,
            //    x0 = startX,
            //    y0 = startY,
            //    t1 = endT1,
            //    x1 = endX,
            //    y1 = endY
            //};
            if (animate2.t != 0)
            {
                animateResult.Add(animate2.x);
                animateResult.Add(animate2.y);
                animateResult.Add(animate2.t);
            }
            //  animateResult.Add(animate2);
            return(animateResult);
        }