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

C# Directions类代码示例

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

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



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

示例1: AxisEdge

 internal AxisEdge(VisibilityVertex source, VisibilityVertex target)
     : base(source, target){
     RightBound = double.PositiveInfinity;
     LeftBound = double.NegativeInfinity;
     Direction = CompassVector.DirectionsFromPointToPoint(source.Point, target.Point);
     Debug.Assert(Direction == Directions.East || Direction == Directions.North);
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:7,代码来源:AxisEdge.cs


示例2: GetSurroundingPosition

 public Position GetSurroundingPosition(Position start, Directions direction)
 {
     Position position;
     switch (direction)
     {
         case Directions.North:
             position = new Position(start.X, start.Y - 1);
             break;
         case Directions.South:
             position = new Position(start.X, start.Y + 1);
             break;
         case Directions.West:
             position = new Position(start.X - 1, start.Y);
             break;
         case Directions.East:
             position = new Position(start.X + 1, start.Y);
             break;
         case Directions.NorthEast:
             position = new Position(start.X + 1, start.Y - 1);
             break;
         case Directions.NorthWest:
             position = new Position(start.X - 1, start.Y - 1);
             break;
         case Directions.SouthWest:
             position = new Position(start.X - 1, start.Y + 1);
             break;
         default:
             position = new Position(start.X + 1, start.Y + 1);
             break;
     }
     return position;
 }
开发者ID:cschrammel,项目名称:Voracity-aspnet5,代码行数:32,代码来源:SurroundingTileFinder.cs


示例3: AdjacentSquare

 /// <summary>
 /// Returns the square at the specified side of the specified square.  If there is no square at that side (for example, if side isUpRight and the square is at the top of the board) then returns null.
 /// </summary>
 /// <param name="square"></param>
 /// <param name="side"></param>
 /// <returns></returns>
 private static Square AdjacentSquare(Square[,] board, Square square, Directions side)
 {
     switch (side) {
     case Directions.UpRight:
       //If there is a square to the up right and square is not on the right or top sides of the board.  If not then returns null.
       if (square.Left < 7 && square.Top > 0)
         return board[square.Left + 1, square.Top - 1];
       break;
     case Directions.UpLeft:
       //If there is a square to the up left of square and square is not on the left side or the top side.
       if (square.Left > 0 && square.Top > 0)
         return board[square.Left - 1, square.Top - 1];
       break;
     case Directions.DownRight:
       //If there is a square to the down right of square and square is not on the right or bottom sides of the board.
       if (square.Left < 7 && square.Top < 7)
         return board[square.Left + 1, square.Top + 1];
       break;
     case Directions.DownLeft:
       //If there is a square to the down left of square and square is not on the left or bottom sides of the board.
       if (square.Left > 0 && square.Top < 7)
         return board[square.Left - 1, square.Top + 1];
       break;
     //If there is no such square because square is on the wrong side of the board and the appropriate condition was false (otherwise, the function would no longer be running) then return null.
     }
     return null;
 }
开发者ID:ArthurLaks,项目名称:Games,代码行数:33,代码来源:Library.cs


示例4: SetDirection

 public void SetDirection(Directions dir)
 {
     int index = (int)dir;
     for (int i = 0; i < 4; i++) {
         directions [i].material = (i == index) ? selected : normal;
     }
 }
开发者ID:arthurwoo,项目名称:TaticsHero,代码行数:7,代码来源:FacingIndicator.cs


示例5: PrintDirections

        private static void PrintDirections(Directions directions, string origin, string destination)
        {
            Console.WriteLine("Directions: {0} to {1}", origin, destination);
            Console.WriteLine(directions.copyrights);

            for (var r = 0; r < directions.Routes.Count(); r++)
            {
                var route = directions.Routes.ElementAt(r);

                Console.WriteLine();
                Console.WriteLine("Route {0}: {1} [Distiance={2}, Duration={3}]",
                    r + 1, route.summary, route.distance, route.duration);

                for (var l = 0; l < route.Legs.Count(); l++)
                {
                    var leg = route.Legs.ElementAt(l);

                    Console.WriteLine("");
                    Console.WriteLine("Leg #{0}", l + 1);

                    for (var s = 0; s < leg.Steps.Count(); s++)
                    {
                        var step = leg.Steps.ElementAt(s);

                        Console.WriteLine("[{0} - {1} - {2}]: {3}",
                            step.travel_mode, step.duration.text,
                            step.distance.text,
                            step.html_instructions);
                    }
                }
            }
        }
开发者ID:magonzalez,项目名称:SomethingCool,代码行数:32,代码来源:Program.cs


示例6: OnCollisionEnter2D

 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.CompareTag("world")){
         direction = Directions.NONE;
         animator.Play("cdman_stand");
     }
     if (col.gameObject.CompareTag ("point")) {
         audioPoint.Play();
         Destroy(col.gameObject);
         Score+=100;
     }
     if (col.gameObject.CompareTag ("point_super")) {
         audioPoint.Play();
         Destroy(col.gameObject);
         Score+=500;
     }
     if (col.gameObject.CompareTag ("enemy")) {
         respounter.On=false;
         Instantiate(dieAnimation, transform.position,Quaternion.Euler(0,0,0));
         Destroy(gameObject);
         //удаляем всех врагов
         foreach(GameObject enemy in GameObject.FindGameObjectsWithTag("enemy"))
         {
             Destroy(enemy);
         }
     }
 }
开发者ID:Newbilius,项目名称:unity_cdman,代码行数:27,代码来源:cdman_control.cs


示例7: Movement

	void Movement ()
	{
		//getaxisraw has binary left right as opposed to the more analogue getaxis
		Vector2 movementVector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

		if (movementVector != Vector2.zero)
		{
			anim.SetBool("isWalking", true);
			anim.SetFloat("inputX", movementVector.x);
			anim.SetFloat("inputY", movementVector.y);


			if (movementVector.x == 1)
				direction = Directions.East;
			else if (movementVector.x == -1)
				direction = Directions.West;
			else if (movementVector.y == 1)
				direction = Directions.North;
			else if (movementVector.y == -1)
				direction = Directions.South;
		}
		else
		{
			anim.SetBool("isWalking", false);
		}

		rBody.MovePosition(rBody.position + movementVector * Time.deltaTime);

	}
开发者ID:ibzzie,项目名称:FutilitySimulator2D,代码行数:29,代码来源:PlayerControl.cs


示例8: Update

        public void Update(Directions direction, int position)
        {
            // Sets Direction so the gap created when turning can be filled
            Direction = direction;

            if (direction == Directions.Up)
            {
                Border.Width = 20;
                int y = Border.Y;
                Border.Height += y - position;
                Border.Y = position;
            }

            if (direction == Directions.Down)
            {
                Border.Width = 20;
                Border.Height = position - Border.Y;
            }

            // Records the value of x before updating then sets the new
            // width by adding the distance between x and the new position
            // of x.  Finally sets the new value of x.
            if (direction == Directions.Left)
            {
                int x = Border.X;
                Border.Width += x - position;
                Border.X = position;
            }

            // Expands the width by subtracting the position of the left
            // side of the bar from the new position giving it its width
            if (direction == Directions.Right)
                Border.Width = position - Border.X;
        }
开发者ID:hikarumodoki,项目名称:LaserWalls,代码行数:34,代码来源:Wall.cs


示例9: ScriptEntityMove

 public ScriptEntityMove(Entity entity, Directions direction, int distance)
 {
     this.direction = direction;
     this.distance = distance;
     this.entity = entity;
     this.entity.OnMoveFinished += new Entity.EventHandler(moveFinished);
 }
开发者ID:Gayo,项目名称:Gayo-CAROT,代码行数:7,代码来源:ScriptEntityMove.cs


示例10: SetDirection

    public void SetDirection(Directions direction)
    {
        float x = 0f;
        float y = 0f;

        switch (direction)
        {
            case Directions.Up:
                y = 1f;
                break;
            case Directions.Down:
                y = -1f;
                break;
            case Directions.Left:
                x = -1f;
                break;
            case Directions.Right:
                x = 1f;
                break;
        }

        if (anim != null)
        {
            anim.SetFloat("InputX", x);
            anim.SetFloat("InputY", y);
        }
    }
开发者ID:mildsauce45,项目名称:NowItsOurTurn,代码行数:27,代码来源:TiledHeroController.cs


示例11: CheckCollision

        public override bool CheckCollision(GameObject two, out Directions direction, out Vector2 diffVector)
        {
            direction = Directions.Up; //Default direction value
            diffVector = Vector2.Zero; //Default vector value

            //Get the center point circle
            Vector2 center = new Vector2(this.Position.X + this.Radius, this.Position.Y + this.Radius);

            //Calculate AABB info (center, half-extents)
            Vector2 aabbHalf = new Vector2(two.Size.X / 2, two.Size.Y / 2);
            Vector2 aabbCenter = two.Position + aabbHalf;

            //Get difference vector between both centers
            Vector2 diff = center - aabbCenter;
            Vector2 clamped = new Vector2(clamp(diff.X, -aabbHalf.X, aabbHalf.X), clamp(diff.Y, -aabbHalf.Y, aabbHalf.Y));

            //Add clamped value to AABB Center and get the value of point closest to cirlce
            Vector2 closest = aabbCenter + clamped;

            diff = closest - center;

            if (diff.Length <= this.Radius)
            {
                direction = VectorDirection(diff);
                diffVector = diff;
                return true;
            }

            return false;
        }
开发者ID:minalear,项目名称:Breakout,代码行数:30,代码来源:BallObject.cs


示例12: Move

 public void Move(Directions direction)
 {
     switch (direction)
     {
         case Directions.Up:
             if (!DetectSelfCollision(0, -1))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         case Directions.Down:
             if (!DetectSelfCollision(0, 1))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         case Directions.Right:
             if (!DetectSelfCollision(1, 0))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         case Directions.Left:
             if (!DetectSelfCollision(-1, 0))
             {
                 Move(XMultiplier(direction), YMultiplier(direction));
             }
             break;
         default:
             break;
     }
 }
开发者ID:ivopashov,项目名称:snakegame,代码行数:32,代码来源:Snake.cs


示例13: command

 public void command(CharacterCommands command, params object[] args)
 {
     switch(command)
     {
         case CharacterCommands.SetEntityQuery:
             eq = (IEntityQuery)args[0];
             return;
         case CharacterCommands.Face:
             System.Console.WriteLine("face");
             state = 0;
             d = (Directions)args[0];
             return;
         case CharacterCommands.Walk:
             System.Console.WriteLine("walk");
             state = 1;
             if(d == (Directions)args[0]) step = step==0?1:0;
             else step = 0;
             d = (Directions)args[0];
             counter = 0;
             break;
         case CharacterCommands.Stop:
             System.Console.WriteLine("stop");
             state = 0;
             return;
         case CharacterCommands.Step:
             System.Console.WriteLine("step");
             state = 2;
             if(d == (Directions)args[0]) step = (step+1)&1;
             else step = 0;
             d = (Directions)args[0];
             counter = 0;
             return;
     }
 }
开发者ID:Gayo,项目名称:Gayo-CAROT,代码行数:34,代码来源:FF6ChrController.cs


示例14: setFacingDirection

 //This only works assuming the cultist starts facing left before calling this function.
 //Contains hack-y code )=
 public void setFacingDirection(Directions.Direction dir)
 {
     switch(dir)
     {
         case Directions.Direction.UP:
             transform.rotation = normalRotation;
             transform.Rotate(new Vector3(0, 0, 90));
             canvas.transform.Rotate(new Vector3(0, 0, 90)); //To rotate it back to where it should be...
             transform.localScale = new Vector3(-1 * normalScale.x, normalScale.y, normalScale.z);
             canvas.transform.localScale = new Vector3(-1 * canvas.transform.localScale.x, canvas.transform.localScale.y, canvas.transform.localScale.z); //To flip it back to how it should be...
             break;
         case Directions.Direction.DOWN:
             transform.rotation = normalRotation;
             transform.Rotate(new Vector3(0, 0, 90));
             canvas.transform.Rotate(new Vector3(0, 0, -90)); //To rotate it back to where it should be...
             transform.localScale = normalScale;
             break;
         case Directions.Direction.LEFT:
             transform.rotation = normalRotation;
             transform.localScale = normalScale;
             break;
         case Directions.Direction.RIGHT:
             transform.rotation = normalRotation;
             transform.localScale = new Vector3(-1 * normalScale.x, normalScale.y, normalScale.z);
             canvas.transform.localScale = new Vector3(-1 * canvas.transform.localScale.x, canvas.transform.localScale.y, canvas.transform.localScale.z); //To flip it back to how it should be...
             break;
         default:
             break;
     }
 }
开发者ID:stokesc,项目名称:EscapefromCultTown,代码行数:32,代码来源:CultistMove.cs


示例15: CanTankMove

        public bool CanTankMove(Tank tank, List<Tank> enemies, Directions direction)
        {
            NewPosition newTankPosition = new NewPosition(tank, direction);
            bool collides = false;

            if (newTankPosition.Row >= 2 && newTankPosition.Row < Data.GetWindowHeight() - 4 &&
                newTankPosition.Column >= 0 && newTankPosition.Column < Data.GetWindowWidth() - 3)
            {
                collides = true;
            }

            for (int elemRow = 0; elemRow < mapElements.GetLength(0); elemRow++)
            {
                for (int elemCol = 0; elemCol < mapElements.GetLength(1); elemCol++)
                {
                    if (mapElements[elemRow, elemCol] != null)
                    {
                        if (DoesItCollideTank(mapElements[elemRow, elemCol], tank, newTankPosition.Row, newTankPosition.Column))
                        {
                            collides = false;
                        }
                    }
                }
            }

            if (collides)
            {
                collides = TankIsOnAtherTank(tank, enemies, newTankPosition);
            }

            return collides;
        }
开发者ID:Elinos,项目名称:TelerikAcademy,代码行数:32,代码来源:Collision.cs


示例16: OracleSuggestion

 public OracleSuggestion(UnitPosition position, Directions lockingDirection, Map lockedFinalMap, double metrics = 0)
 {
     Position = position;
     LockingDirection = lockingDirection;
     this.LockedFinalMap = lockedFinalMap;
     Metrics = metrics;
 }
开发者ID:xoposhiy,项目名称:icfpc2015,代码行数:7,代码来源:OracleSuggestion.cs


示例17: turn

	public void turn(char dir) 
	{
		if (dir == 'L') 
		{
			if (facing != Directions.N) 
			{
				facing -= 1;
			}
			else 
			{
				facing = Directions.W;
			}
		}
		else {
			if (facing != Directions.W) 
			{
				facing += 1;
			}
			else 
			{
				facing = Directions.N;
			}
		}

	}
开发者ID:CatsFromMars,项目名称:RubberDuckAdventure,代码行数:25,代码来源:Robot.cs


示例18: Car

 //initialize Car
 public Car(int initialValue, int color)
 {
     //PickBrush();
     if (initialValue == 0)
     {
         InitialV = initialValue;
         direction = Directions.Left;
     }
     else if (initialValue == 1)
     {
         InitialV = initialValue;
         direction = Directions.Up;
     }
     else if (initialValue == 2)
     {
         InitialV = initialValue;
         direction = Directions.Right;
     }
     else
     {
         InitialV = initialValue;
         direction = Directions.Down;
     }
     this.color = color;
     AddEnd(); AddEnd();
 }
开发者ID:han308,项目名称:Bmtron-PC,代码行数:27,代码来源:Car.cs


示例19: CheckValidMove

        /// <summary>
        /// Returns if the desired movement is valid
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="floorNumber"></param>
        /// <param name="roomNumber"></param>
        /// <returns></returns>
        public bool CheckValidMove(Directions direction, int floorNumber, int roomNumber)
        {
            bool valid = false;

            int directionValue = (int)direction;

            if (!(direction == Directions.Up | direction == Directions.Down))
            {
                if ((_rooms[floorNumber, roomNumber].Doors[directionValue, 0] == floorNumber))
                {
                    if (!(_rooms[floorNumber, roomNumber].Doors[directionValue, 1] == roomNumber))
                    {
                        valid = true;
                    }
                }
            }
            else
            {
                if (!(_rooms[floorNumber, roomNumber].Doors[directionValue, 0] == floorNumber))
                {
                    valid = true;
                }
            }

            return valid;
        }
开发者ID:Voidable,项目名称:TB-Quest-Game,代码行数:33,代码来源:ZoneMaster.cs


示例20: MovementItem

 public MovementItem(ScreenPoint destination, MovementType type, Directions direction, string animationname)
 {
     this.destination = destination;
     this.type = type;
     this.direction = direction;
     this.animationname = animationname;
 }
开发者ID:NullSoldier,项目名称:Valkyrie,代码行数:7,代码来源:MovementItem.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Directory类代码示例发布时间:2022-05-24
下一篇:
C# DirectionType类代码示例发布时间: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