• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Rotation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Rotation的典型用法代码示例。如果您正苦于以下问题:C# Rotation类的具体用法?C# Rotation怎么用?C# Rotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Rotation类属于命名空间,在下文中一共展示了Rotation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Rotate

 public bool Rotate(Rotation rotation)
 {
     int deltaX, deltaY;
     Deck head = Decks.First();
     if (IsShipRotatable())
     {
         GetRotationDirection(out deltaY, out deltaX);
         for (int i = 1; i < Decks.Count; i++)
         {
             int newX = 0, newY = 0;
             switch (rotation)
             {
                 case Rotation.Left:
                     newX = head.X - deltaX * i;
                     newY = head.Y - deltaY * i;
                     break;
                 case Rotation.Right:
                     newX = head.X + deltaX * i;
                     newY = head.Y + deltaY * i;
                     break;
             }
             if (AreCoordinatesNotNegative(newX, newY))
             {
                 Decks.ElementAt(i).X = newX;
                 Decks.ElementAt(i).Y = newY;
             }
             else
             {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:ysedletskaya,项目名称:SeaFight,代码行数:34,代码来源:SimpleShip.cs


示例2: CreateRotation

 static Rotation CreateRotation()
 {
     var rotation = new Rotation { Id = 2, Name = "TheRotation", RotationType = RotationTypes.Rotation1 };
       var startTime = new DateTime(1, 1, 1, 7, 0, 0);
       rotation.RotationShifts.Add(new RotationShift(TimeConstants.Weekday, startTime, startTime.AddHours(12).AddMinutes(-1)));
       return rotation;
 }
开发者ID:BobHemphill,项目名称:Scheduling-App,代码行数:7,代码来源:Program.cs


示例3: FromReader

 public override void FromReader(IMinecraftDataReader reader)
 {
     Rotation = new Rotation(
         reader.ReadFloat(), 
         reader.ReadFloat(), 
         reader.ReadFloat());
 }
开发者ID:beppe9000,项目名称:MineLib.Network,代码行数:7,代码来源:EntityMetadataRotation.cs


示例4: CanTurn

 public void CanTurn(Rotation rotation)
 {
     var ant = new Ant(_initialDirection, _initialPosition);
     var expectedDirection = _initialDirection.Rotate(rotation);
     ant.Turn(rotation);
     ant.Direction.Should().Be(expectedDirection);
 }
开发者ID:kolman,项目名称:LangtonsAnt,代码行数:7,代码来源:AntTest.cs


示例5: ShipInstance

        public ShipInstance(Position pos, Rotation r, Ship ship)
        {
            this.pos = pos;
            this.rotation = r;
            this.ship = ship;

            this.sunken = false;
        }
开发者ID:ylt,项目名称:Battleships,代码行数:8,代码来源:ShipInstance.cs


示例6: ReversePath

 public static void ReversePath(Rotation[] path)
 {
     for (int i = 0; i < path.Length; i++)
     {
         path[i] = (Rotation)(((byte)path[i] + 2) % 4);
     }
     Array.Reverse(path);
 }
开发者ID:exyi,项目名称:LtpRobot,代码行数:8,代码来源:MapUtils.cs


示例7: X3DViewpoint

		public X3DViewpoint (float? fieldOfView, Vector3? position, 
		                     Rotation orientation, Vector3? centerOfRotation)
		{
			this.FieldOfView = fieldOfView;
			this.Position = position;
			this.Orientation = orientation;
			this.CenterOfRotation = centerOfRotation;
		}
开发者ID:RCBiczok,项目名称:ParaUnity,代码行数:8,代码来源:X3DViewpoint.cs


示例8: X3DTransform

		public X3DTransform (X3DNode[] nodes,  
			Vector3? translation, 
			Rotation rotatio, 
			Vector3? scale) : base (nodes)
		{
			this.Translation = translation;
			this.Rotation = rotatio;
			this.Scale = scale;
		}
开发者ID:RCBiczok,项目名称:ParaUnity,代码行数:9,代码来源:X3DTransform.cs


示例9: SetRotation

        private void SetRotation(Rotation rotation)
        {
            var prefabRotation = doorPrefab.transform.eulerAngles;

            prefabRotation.y = RotationHelper.GetEulerAngle(rotation);

            this.goReference.transform.eulerAngles = prefabRotation;
            this.rotation = rotation;
        }
开发者ID:PhilippCh,项目名称:SpaceStationSimulator,代码行数:9,代码来源:DoorObject.cs


示例10: Start

 // Use this for initialization
 void Start()
 {
     originalPos = transform.position;
     originalPos.z = 0;
     leashLength = 0.5f;
     moveSpeed = 1.0f;
     playerController = memoizer.GetMemoizedComponent<CharacterController>(gameObject);
     rotateScript = memoizer.GetMemoizedComponent<Rotation>(GameObject.FindGameObjectWithTag("Sphere"));
 }
开发者ID:apleshak,项目名称:Copy-for-Sasha,代码行数:10,代码来源:PlayerController.cs


示例11: SETItem

 public SETItem(EditorItemSelection selectionManager)
     : base(selectionManager)
 {
     Position = new Vertex();
     Rotation = new Rotation();
     Scale = new Vertex();
     objdef = LevelData.ObjDefs[id];
     bounds = objdef.GetBounds(this);
 }
开发者ID:Radfordhound,项目名称:sa_tools,代码行数:9,代码来源:SETItem.cs


示例12: ApplyMove

 // Apply a full move to the board
 // This swaps CurrentPlayer
 public bool ApplyMove(int xCoord, int yCoord, PieceColor color, Rotation r)
 {
     bool placed = this.PlacePieceAt(xCoord, yCoord, color);
     if (placed)
     {
         this.DoRotation(r);
         this.CurrentPlayer = (color == PieceColor.White) ? PieceColor.Black : PieceColor.White;
     }
     return placed;
 }
开发者ID:latkin,项目名称:pentagoag,代码行数:12,代码来源:Board.cs


示例13: Rotate

        public float Rotate(Rotation rotation, float _Rotation)
        {
            if (rotation == Rotation.Left)
                return RotateLeft(_Rotation);

            if (rotation == Rotation.Right)
                return RotateRight(_Rotation);

            return 0;
        }
开发者ID:qvotaxon,项目名称:game-design-herkansing,代码行数:10,代码来源:BaseMovementBehaviour.cs


示例14: Rotation

 public Rotation(string name, double roll, double pitch, double yaw)
 {
     self = this;
     self.name = name;
     self.roll = roll;
     self.pitch = pitch;
     self.yaw = yaw;
     self.r = new Matrix3();
     r.from_euler(roll, pitch, yaw);
 }
开发者ID:ChukRhodes,项目名称:MissionPlanner,代码行数:10,代码来源:Magfitrotation.cs


示例15: SpawnDoor

        private void SpawnDoor(IntVector3 position, Rotation rotation)
        {
            if (this.goReference == null) {
                PreloadPrefabs();

                this.goReference = doorPrefab.Spawn();
                this.goReference.transform.position = position.ToVector3();

                SetRotation(rotation);
            }
        }
开发者ID:PhilippCh,项目名称:SpaceStationSimulator,代码行数:11,代码来源:DoorObject.cs


示例16: GenerateMessage

        public void GenerateMessage()
        {
            var rotation = new Rotation {
                Id = 1,
                Name = "Name",
                RotationType = RotationTypes.Rotation3
            };
            var rotationMessage = new RotationMessage(rotation);

            ServiceTestHelper.AssertDomainMessageProperties(rotation, rotationMessage);
            Assert.AreEqual(rotation.RotationType, rotationMessage.RotationType);
        }
开发者ID:BobHemphill,项目名称:Scheduling-App,代码行数:12,代码来源:RotationMessageTest.cs


示例17: Test_Rover_Can_Rotate_90_Degrees

        public void Test_Rover_Can_Rotate_90_Degrees(Direction startDirection, Rotation rotateDirection, Direction endDirection)
        {
            var startPosition = new Position { Direction = startDirection, X = 0, Y = 0 };
            var rover = new Rover(startPosition);

            rover.Rotate(rotateDirection);

            var newPosition = rover.GetCurrentPosition();
            var expectedPosition = new Position { Direction = endDirection, X = 0, Y = 0 };

            Assert.AreEqual(newPosition, expectedPosition);
        }
开发者ID:leethomascook,项目名称:Mars-Rover,代码行数:12,代码来源:DirectionalTests.cs


示例18: Rotate

 public Direction Rotate(Rotation rotation)
 {
     switch (rotation)
     {
         case Rotation.Left:
             return new Direction(-_dy, _dx);
         case Rotation.Right:
             return new Direction(_dy, -_dx);
         default:
             throw new ArgumentOutOfRangeException("rotation");
     }
 }
开发者ID:kolman,项目名称:LangtonsAnt,代码行数:12,代码来源:Direction.cs


示例19: Rotate

        public void Rotate(Rotation direction)
        {
            switch(direction)
            {
                case Rotation.Left:
                    RotateLeft();
                    break;

                case Rotation.Right:
                    RotateRight();
                    break;
            }
        }
开发者ID:leethomascook,项目名称:Mars-Rover,代码行数:13,代码来源:Rover.cs


示例20: Rotate

        public static Directions Rotate(this Directions direction, Rotation rotation)
        {
            // Counter Clockwise
            if (rotation == Rotation.CounterClockwise)
            {
                switch (direction)
                {
                    default:
                        return Directions.None;
                    case Directions.Up:
                        return Directions.UpperLeft;
                    case Directions.UpperLeft:
                        return Directions.Left;
                    case Directions.Left:
                        return Directions.LowerLeft;
                    case Directions.LowerLeft:
                        return Directions.Down;
                    case Directions.Down:
                        return Directions.LowerRight;
                    case Directions.LowerRight:
                        return Directions.Right;
                    case Directions.Right:
                        return Directions.UpperRight;
                    case Directions.UpperRight:
                        return Directions.Up;
                }
            }

            // Clockwise
            switch (direction)
            {
                default:
                    return Directions.None;
                case Directions.Up:
                    return Directions.UpperRight;
                case Directions.UpperRight:
                    return Directions.Right;
                case Directions.Right:
                    return Directions.LowerRight;
                case Directions.LowerRight:
                    return Directions.Down;
                case Directions.Down:
                    return Directions.LowerLeft;
                case Directions.LowerLeft:
                    return Directions.Left;
                case Directions.Left:
                    return Directions.UpperLeft;
                case Directions.UpperLeft:
                    return Directions.Up;
            }
        }
开发者ID:zachwhite,项目名称:pathfinding,代码行数:51,代码来源:Directions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RoundStyle类代码示例发布时间:2022-05-24
下一篇:
C# RotateFlipType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap