当前位置: 首页>>代码示例>>C#>>正文


C# Coordinate.ToString方法代码示例

本文整理汇总了C#中Coordinate.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Coordinate.ToString方法的具体用法?C# Coordinate.ToString怎么用?C# Coordinate.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Coordinate的用法示例。


在下文中一共展示了Coordinate.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPlace

        public override Task<Place> GetPlace( Coordinate coordinate )
        {
            var filepath = Path.ChangeExtension( Path.Combine( placesDirectory, coordinate.ToString() ), _extensions );

              var data = JsonDataItem.LoadData( filepath, "{ 'Building': '{EB0C8AE8-FC09-4874-9985-98C081F4D1B7}' }" );

              return Task.FromResult( (Place) new JsonPlace( data ) );
        }
开发者ID:h2h,项目名称:HelloWorld,代码行数:8,代码来源:JsonDataService.cs

示例2: CpuGuess

 private static void CpuGuess(Game game, Guid playerId)
 {
     var random = new Random();
     try
     {
         var guess = new Coordinate(random.Next(0, 10), random.Next(0, 10));
         var result = game.Guess(playerId, guess);
         Console.WriteLine("Computer guessed {0}, it was a {1}!", guess.ToString(true), result);
     }
     catch (AlreadyGuessedException)
     {
         // Just continue and guess again.
     }
 }
开发者ID:danielrbradley,项目名称:PebbleShips,代码行数:14,代码来源:Program.cs

示例3: GetPlace

        /// <summary>
        /// 获取一个地块对象
        /// </summary>
        /// <param name="coordinate">地块坐标</param>
        /// <returns></returns>
        public Place GetPlace( Coordinate coordinate )
        {
            lock ( _sync )
              {

            Place place;
            if ( places.TryGetValue( coordinate, out place ) )
              return place;

            var filepath = Path.ChangeExtension( Path.Combine( placesDirectory, coordinate.ToString() ), _extensions );
            var data = JsonDataItem.LoadData( filepath, new { CheckPoint = DateTime.UtcNow } );

            place = GameHost.GameRules.CreatePlace( coordinate );
            place.InitializeData( this, data );

            return place;
              }
        }
开发者ID:Ivony,项目名称:HelloWorld,代码行数:23,代码来源:JsonDataService.cs

示例4: Main

        static void Main(string[] args)
        {
            World world = World.GenerateWorld(JsonHelper.ParseNetlink("http://shuttles.rpi.edu/displays/netlink.js"));
            EtaCalculator etaCalc = new EtaCalculator(world);

            Coordinate ep1 = new Coordinate(37760814, -77030853);
            Coordinate ep2 = new Coordinate(40366681, -123921572);
            Coordinate c = new Coordinate(55891119, -92376489);
            c = c.ClosestPoint(ep1, ep2);
            Console.WriteLine(c.ToString());

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
            //while (true)
            //{
            //	etaCalc.Recalculate();
            //}
        }
开发者ID:AbstractedSheep,项目名称:Shuttle-Tracker,代码行数:18,代码来源:Program.cs

示例5: test_ToString

		public void test_ToString()
		{
			//create a coordinate
			Coordinate coord = new Coordinate(testX, testY, testZ);

			Assertion.AssertEquals("ToString: ", "(1, 2, 3)", coord.ToString());
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:CoordinateTest.cs

示例6: GenerateSampleData

        private void GenerateSampleData()
        {
            _netLayer.ClearData();

            //--sample for show smothness
            var rnd = new Random();
            var rangeX = Convert.ToInt32((Settings.Default.RightMapBound - Settings.Default.LeftMapBound) * 100000);
            var rangeY = Convert.ToInt32((Settings.Default.TopMapBound - Settings.Default.BottomMapBound) * 100000);

            var longitude1 = Convert.ToDecimal(Settings.Default.LeftMapBound + (double) rnd.Next(0, rangeX)/100000);
            var latitude1 = Convert.ToDecimal(Settings.Default.BottomMapBound + (double)rnd.Next(0, rangeY) / 100000);

            var cableDbRows = new SimpleMapDb.CablesDataTable();
            var vertexDbRows = new SimpleMapDb.VertexesDataTable();
            while (cableDbRows.Count < 200)
            {
                var cableRow = cableDbRows.NewCablesRow();

                cableRow.Longitude1 = longitude1;
                cableRow.Latitude1 = latitude1;
                cableRow.Longitude2 = Convert.ToDecimal(Settings.Default.LeftMapBound + (double)rnd.Next(0, rangeX) / 100000);
                cableRow.Latitude2 = Convert.ToDecimal(Settings.Default.BottomMapBound + (double)rnd.Next(0, rangeY) / 100000);
                var rect = new CoordinateRectangle(cableRow.Longitude1, cableRow.Latitude1, cableRow.Longitude2, cableRow.Latitude2);
                cableRow.Length = Convert.ToDecimal(rect.LineLength);
                if (cableRow.Length <= 5000 && cableRow.Length > 200)
                {
                    longitude1 = cableRow.Longitude2;
                    latitude1 = cableRow.Latitude2;
                    cableRow.Caption = rect.ToString();
                    cableDbRows.AddCablesRow(cableRow);

                    var vertexRow = vertexDbRows.NewVertexesRow();

                    vertexRow.Longitude = longitude1;
                    vertexRow.Latitude = latitude1;

                    var pt = new Coordinate(vertexRow.Longitude, vertexRow.Latitude);
                    vertexRow.Caption = pt.ToString();
                    vertexDbRows.AddVertexesRow(vertexRow);
                }
            }
            _netLayer.MergeData(vertexDbRows);
            _netLayer.MergeData(cableDbRows);
            //--end sample
        }
开发者ID:agafonoff2000,项目名称:SimpleMap,代码行数:45,代码来源:MapCtl.cs

示例7: Move

        /// <summary>
        /// </summary>
        /// <param name="moveType">
        /// </param>
        /// <param name="newCoordinates">
        /// </param>
        /// <param name="heading">
        /// </param>
        /// <returns>
        /// </returns>
        /// <exception cref="NotImplementedException">
        /// </exception>
        public bool Move(int moveType, Coordinate newCoordinates, Quaternion heading)
        {
            // Procedure:
            // 1. Check if new coordinates are plausible (in range of runspeed since last update)
            // 2. Set coordinates & heading

            // Is this correct? Shouldnt the client input be compared to the prediction and then be overridden to prevent teleportation exploits?
            // - Algorithman

            // give it a bit uncertainty (2.0f)
            LogUtil.Debug(
                DebugInfoDetail.Movement,
                newCoordinates.ToString() + "<->" + this.Character.Coordinates().ToString());
            // if (newCoordinates.Distance2D(this.Character.Coordinates) < 2.0f)
            {
                this.Character.SetCoordinates(newCoordinates, heading);
                this.Character.UpdateMoveType((byte)moveType);
            }
            /*
            else
            {
                this.Character.StopMovement();
            }
            */
            return true;
        }
开发者ID:CellAO,项目名称:CellAO-NightPredator,代码行数:38,代码来源:PlayerController.cs

示例8: MoveAbsolut

 /// <summary>
 /// Moves Roboter arm to given absolut coordinates
 /// </summary>
 /// <param name="coordinates">Coordinates to move to</param>
 /// <param name="speed">Speed to move</param>
 /// <param name="instant">whether to execute command instant or not</param>
 public void MoveAbsolut(Coordinate coordinates, int speed, bool instant)
 {
     var message = new RobotCommand("MP", coordinates.ToString());
     Speed(speed, instant);
     SendMessage(message, instant);
 }
开发者ID:arminhenres,项目名称:BeerBot,代码行数:12,代码来源:MoveMasterRobot.cs

示例9: SquareOccupiedException

 public SquareOccupiedException(Creature intruder, Creature occupant, Coordinate coordinate)
     : base(intruder.ToString() +"Cannot move to "+coordinate.ToString()+". Square is occupied by " + occupant.ToString() + ".")
 {
 }
开发者ID:neilguertin,项目名称:Bound-in-Steel,代码行数:4,代码来源:SquareOccupiedException.cs

示例10: CalculatePredictedPosition

        internal Coordinate CalculatePredictedPosition()
        {
            if ((this.moveDirection == MoveDirections.None) && (this.strafeDirection == SpinOrStrafeDirections.None))
            {
                return new Coordinate(this.RawCoordinates);
            }
            else if (this.spinDirection == SpinOrStrafeDirections.None)
            {
                Vector3 moveVector = this.CalculateMoveVector();

                moveVector = moveVector * this.PredictionDuration.TotalSeconds;

                /*this.RawCoordinates = new Vector3()
                                      {
                                          x = this.RawCoordinates.X + moveVector.x,
                                          y = this.RawCoordinates.Y + moveVector.y,
                                          z = this.RawCoordinates.Z + moveVector.z
                                      };

                this.PredictionTime = DateTime.UtcNow;*/
                Coordinate result =
                    new Coordinate(
                        new Vector3(
                            this.RawCoordinates.X + moveVector.x,
                            this.RawCoordinates.Y + moveVector.y,
                            this.RawCoordinates.Z + moveVector.z));
                LogUtil.Debug(
                    DebugInfoDetail.Movement,
                    moveVector.ToString().PadRight(40) + "/" + result.ToString() + "/");
                return result;
            }
            else
            {
                Vector3 moveVector;
                Vector3 positionFromCentreOfTurningCircle;
                double turnArcAngle;
                double y;
                double duration;

                duration = this.PredictionDuration.TotalSeconds;

                moveVector = this.CalculateMoveVector();
                turnArcAngle = this.calculateTurnArcAngle();

                // This is calculated seperately as height is unaffected by turning
                y = this.RawCoordinates.Y + (moveVector.y * duration);

                if (this.spinDirection == SpinOrStrafeDirections.Left)
                {
                    positionFromCentreOfTurningCircle = new Vector3(moveVector.z, y, -moveVector.x);
                }
                else
                {
                    positionFromCentreOfTurningCircle = new Vector3(-moveVector.z, y, moveVector.x);
                }

                return
                    new Coordinate(
                        new Vector3(this.RawCoordinates.X, this.RawCoordinates.Y, this.RawCoordinates.Z)
                        + (Vector3)
                            Quaternion.RotateVector3(
                                new Quaternion(Vector3.AxisY, turnArcAngle),
                                positionFromCentreOfTurningCircle) - positionFromCentreOfTurningCircle);
            }
        }
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:65,代码来源:Character.cs

示例11: CreateUnit

        public static Unit CreateUnit( IGameDataService dataService, UnitDescriptor descriptor, Guid owner, Coordinate coordinate, Guid id, string name )
        {
            var data = new JObject() as dynamic;

              data.ID = id;
              data.Name = name;
              data.Owner = owner;
              data.Descriptor = descriptor.Guid;
              data.Coordinate = coordinate.ToString();
              data.State = UnitActionState.Idle;
              data.Mobility = 0m;
              data.LastActTime = DateTime.UtcNow;

              var type = descriptor.InstanceType;
              var unit = (Unit) Activator.CreateInstance( type );

              unit.InitializeData( dataService, data );
              return unit;
        }
开发者ID:Ivony,项目名称:HelloWorld,代码行数:19,代码来源:Unit.cs


注:本文中的Coordinate.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。