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

C# direction类代码示例

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

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



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

示例1: constructHorizontalLayer

        public bool constructHorizontalLayer(List<Data.Rectangle> rectangle, int w,int h)
        {
            this.directionOfLayer = direction.Horizontal;
            int w1 = 0;
            this.start = h;
            this.end = -1;
            while (w1 < w )
            {
                if (rectangle.Count == 0)
                {
                    Console.WriteLine("Zabraklo prostokatow by skonczyc warstwe");
                    return false; //moze cos lepiej
                }
                Data.Rectangle rect = rectangle[0];
                rectangle.Remove(rect);
                this.listUsedRectangles.Add(rect); //niepotzrebne

                Data.PartOfSolution part = new Data.PartOfSolution();
                part.Xlu = w1;
                part.Ylu = h;
                part.Xrd = w1 + rect.Width;
                part.Yrd = h + rect.Height;
                this.listPartOfSolution.Add(part);
                w1 += rect.Width;

                if (this.end == -1 || this.end > part.Yrd)//h + rect.Height)
                    this.end = part.Yrd;// h + rect.Height;  //zapamietuje najglebsze wciecie!!!!!!
                this.lastPartEnd = part.Xrd;
                if (this.end2 < part.Yrd)
                    this.end2 = part.Yrd;
            }
            return true;
        }
开发者ID:BackupTheBerlios,项目名称:taio,代码行数:33,代码来源:Layer.cs


示例2: Move

 //AI Stupid
 void Move()
 {
     switch (currentDirection)
     {
         case direction.right:
             sp.flipX = true;
             if (timer < time)
             {
                 timer += Time.deltaTime;
                 this.transform.Translate(Vector2.right * speed * Time.deltaTime);
             }
             else
             {
                 timer = 0f;
                 currentDirection = direction.left;
             }
             break;
         case direction.left:
             sp.flipX = false;
             if (timer < time)
             {
                 timer += Time.deltaTime;
                 this.transform.Translate(Vector2.left * speed * Time.deltaTime);
             }
             else
             {
                 timer = 0f;
                 currentDirection = direction.right;
             }
             break;
     }
 }
开发者ID:jfcarocota,项目名称:MarioProject,代码行数:33,代码来源:Gumba.cs


示例3: disableDirectionForTime

	IEnumerator disableDirectionForTime(direction dir, float time){
		if (dir == direction.RIGHT) rightDisabled = true;
		else leftDisabled = true;
		yield return new WaitForSeconds(time);
		if (dir == direction.RIGHT) rightDisabled = false;
		else leftDisabled = false;
	}
开发者ID:jimmcnulty41,项目名称:Real494,代码行数:7,代码来源:PhysicsObject.cs


示例4: Step

        /// <summary>
        /// prints the progress bar acorrding to pointers and current direction
        /// </summary>
        public override void Step()
        {
            if (this.currdir == direction.right)
            {
                this.PlacePointer(counter, this.pointer.Length);
                this.counter++;
                if (this.counter+this.pointer.Length == this.bar.Length)
                    this.currdir = direction.left;
            }
            else
            {
                this.PlacePointer(counter - this.pointer.Length, this.pointer.Length);
                this.counter--;
                if (this.counter == this.pointer.Length)
                    this.currdir = direction.right;
            }
            if (usepercent)
            {
                cur++;

                Console.SetCursorPosition(8, 0);
                Console.Write("{0}%", cur / max + 100);
            }

            Console.Write(this.bar + "\r");
        }
开发者ID:SchwarzerLoewe,项目名称:Ecmd,代码行数:29,代码来源:SwayBar.cs


示例5: Move

        public void Move()
        {
            Vector3 position = gameObject.transform.position;
            float newX = position.x;

            switch (moveDiection)
            {
                case direction.left:
                    newX = position.x - Time.deltaTime * movementSpeed;
                    if (newX < minX)
                    {
                        moveDiection = direction.right;
                    }
                    else
                    {
                        position.x = newX;
                    }
                    break;
                case direction.right:
                    newX = position.x + Time.deltaTime * movementSpeed;
                    if (newX > maxX)
                    {
                        moveDiection = direction.left;
                    }
                    else
                    {
                        position.x = newX;
                    }
                    break;
            }

            gameObject.transform.position = position;
        }
开发者ID:CaminhoneiroHell,项目名称:unity-design-patterns,代码行数:33,代码来源:EnemyBehaviour.cs


示例6: Node

        public Thread thread; //the algorithm thread it should run

        #endregion Fields

        #region Constructors

        //CONSTRUCTOR: Initializes the color, the total number of nodes in the system, it's id, and its randomized starting position
        public Node(Color c,int totalNodes,int id, int startingPosition)
        {
            //Initializes variables
            replyNum = 0;
            m_speed = 25;
            m_color = c;
            m_location = startingPosition;
            m_size = totalNodes;
            m_id = id;

            m_timestamp = 0;
            m_requestDeffered = new bool[m_size];
            for (int j = 0; j < m_size; j++)
                m_requestDeffered[j] = false;

            leftCS = 0;
            rightCS = 0;
            dir = direction.left;

            //Create the Node Image to display to the screen
            m_image = new Bitmap(40, 40);
            using (Graphics g = Graphics.FromImage(m_image))
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                //Draws the faded border around the dot
                using (SolidBrush sb = new SolidBrush(Color.FromArgb(127, m_color)))
                    g.FillEllipse(sb, new Rectangle(0, 0, m_image.Width, m_image.Height));

                //Draws the actual small dot centered with the faded border
                g.FillEllipse(Brushes.Black, new Rectangle(m_image.Width / 2 - 2, m_image.Height / 2 - 2, 4, 4));
            }
        }
开发者ID:jjh94c,项目名称:Projects,代码行数:40,代码来源:Node.cs


示例7: ChangeDirection

    public int ChangeDirection()
    {
        string newDir = movementBuffer[bufferIndex];

        if (newDir.ToLower().Equals("up"))
        {
            dir = direction.up;
        }
        else if (newDir.ToLower().Equals("down"))
        {
            dir = direction.down;
        }
        else if (newDir.ToLower().Equals("left"))
        {
            dir = direction.left;
        }
        else if (newDir.ToLower().Equals("right"))
        {
            dir = direction.right;
        }
        else //if (newDir.ToLower().Equals("stop") || newDir == null)
        {
            dir = direction.stop;

        }

        movementBuffer[bufferIndex] = "stop";

        if (bufferIndex < 5)
        {
            bufferIndex++;
        }

        return (int)dir;
    }
开发者ID:ConjureETS,项目名称:VZ,代码行数:35,代码来源:SquadMovement.cs


示例8: GetSymbolByDirection

 public char GetSymbolByDirection(direction Direction)
 {
     if (Direction == direction.left) return Program.map[x - 1, y];
     if (Direction == direction.right) return Program.map[x + 1, y];
     if (Direction == direction.up) return Program.map[x, y - 1];
     return Program.map[x, y + 1];
 }
开发者ID:izmailkov,项目名称:Pacman,代码行数:7,代码来源:Object.cs


示例9: Update

 void Update()
 {
     //Debug.Log(Input.GetAxis("PlayBall"));
     if (rigidbody2D.velocity.x < 0)
     {
         direct = direction.left;
     }
     if (rigidbody2D.velocity.x > 0)
     {
         direct = direction.right;
     }
     if (!gameStarted && Input.GetAxis("PlayBall") > 0.1f)
     {
         float ran = Random.Range(0, 2);
         if (ran > 1f)
             transform.rotation = Quaternion.Euler(0, 0, 180);
         else
             transform.rotation = Quaternion.Euler(0, 0, 0);
         gameStarted = true;
         rigidbody2D.velocity = GlobalBallSpeed.GetBallSpeed(transform.rotation.eulerAngles.z);
     }
     else if(gameStarted)
     {
         if (transform.position.x > 15f)
         {
             GlobalBallSpeed.score.x++;
             restartGame();
         }
         else if (transform.position.x < -15f)
         {
             GlobalBallSpeed.score.y++;
             restartGame();
         }
     }
 }
开发者ID:nolimet,项目名称:Pong_2,代码行数:35,代码来源:ballscript.cs


示例10: testcase

			public testcase (string o, string p, string r, string e, direction d)
			{
				original = o;
				pattern = p;
				replacement = r;
				expected = e;
				direction = d;
			}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:RegexReplace.cs


示例11: StupidGhost

 //Ghost constructor
 public StupidGhost(int x, int y, direction Direction)
 {
     this.X = x;
     this.Y = y;
     currentStatePlace = Program.map.EmptySpace;
     objectDirection = Direction;
     Program.map.RenderChar(x, y, GetSymbol());
 }
开发者ID:izmailkov,项目名称:Pacman,代码行数:9,代码来源:StupidGhost.cs


示例12: SmartGhost

 //Ghost constructor
 public SmartGhost(int x, int y, direction Direction)
 {
     this.X = x;
     this.Y = y;
     currentStatePlace = Program.map.Jewel;
     objectDirection = Direction;
     Program.map.RenderChar(x, y, GetSymbol());
 }
开发者ID:izmailkov,项目名称:Pacman,代码行数:9,代码来源:SmartGhost.cs


示例13: move

		public void move (direction direction)
		{
				//scanner = gameEngine.Instance.getScanner ();
				//start_move ();
				RichmanAnimator rplayer = character_stage.GetComponent<RichmanAnimator> () as RichmanAnimator;
				coming_steps = Random.Range (1, 6);
				rplayer.move (coming_steps);
				player_status = status.MOVING;
		}
开发者ID:GDxU,项目名称:incomplete-richman,代码行数:9,代码来源:RichChar.cs


示例14: SwayBar

 public SwayBar()
     : base()
 {
     this.bar = "|                         |";
     this.pointer = "***";
     this.blankPointer = this.BlankPointer();
     this.currdir = direction.right;
     this.counter = 1;
 }
开发者ID:ferarias,项目名称:RoadkillWikiExtractor,代码行数:9,代码来源:SwayBar.cs


示例15: Flip

    private void Flip()
    {
        currentDirection = (currentDirection == direction.LEFT) ? direction.RIGHT : direction.LEFT;

        selfTransform.localScale = new Vector3(
            (currentDirection == direction.LEFT) ? -initialScale.x : initialScale.x,
            initialScale.y,
            1
        );
    }
开发者ID:octave-ggjparis,项目名称:toc,代码行数:10,代码来源:PlayerControls.cs


示例16: Update

    // Update is called once per frame
    void Update()
    {
        Vector3 tempPos;
        if (p.moving == true) {
            //for one leg
            tempPos = firstLeg.transform.localPosition;
            tempPos.x += ((int)dir) * speed * Time.deltaTime;
            firstLeg.transform.localPosition = tempPos;

            if (tempPos.x >= fmaxdis) {
                dir = direction.left;
            } else if (tempPos.x <= fmindis) {
                dir = direction.right;
            }

            //for second leg

            tempPos = secondLeg.transform.localPosition;
            tempPos.x += ((int)dir) * speed * Time.deltaTime * -1;
            secondLeg.transform.localPosition = tempPos;

            tempPos = thirdLeg.transform.localPosition;
            tempPos.x += ((int)dir) * speed * Time.deltaTime * -1;
            thirdLeg.transform.localPosition = tempPos;

            tempPos = fourthLeg.transform.localPosition;
            tempPos.x += ((int)dir) * speed * Time.deltaTime * 1;
            fourthLeg.transform.localPosition = tempPos;

        } else {

            //TODO can be done with less code!

            //first leg
            tempPos = firstLeg.transform.localPosition;
            tempPos.x = startpositions[0];
            firstLeg.transform.localPosition = tempPos;

            //second Leg
            tempPos = secondLeg.transform.localPosition;
            tempPos.x = startpositions[1];
            secondLeg.transform.localPosition = tempPos;

            //third leg
            tempPos = thirdLeg.transform.localPosition;
            tempPos.x = startpositions[2];
            thirdLeg.transform.localPosition = tempPos;

            //fourth leg
            tempPos = fourthLeg.transform.localPosition;
            tempPos.x = startpositions[3];
            fourthLeg.transform.localPosition = tempPos;

        }
    }
开发者ID:Mechasparrow,项目名称:DeathJam,代码行数:56,代码来源:FootWalk.cs


示例17: HandleSnake

 public void HandleSnake(ctrl key)
 {
     if (key == ctrl.RightArrow && Direction != direction.LEFT)
         Direction = direction.RIGHT;
     else if (key == ctrl.LeftArrow && Direction != direction.RIGHT)
         Direction = direction.LEFT;
     else if (key == ctrl.UpArrow && Direction != direction.DOWN)
         Direction = direction.UP;
     else if (key == ctrl.DownArrow && Direction != direction.UP)
         Direction = direction.DOWN;
 }
开发者ID:Ihor01,项目名称:snake,代码行数:11,代码来源:snake.cs


示例18: Move

 void Move()
 {
     switch (currentDirection)
     {
         case direction.right:
             if(timer < time)
             {
                 timer += Time.deltaTime;
                 this.transform.Translate(Vector2.right * speed * Time.deltaTime);
             }
             else
             {
                 timer = 0f;
                 currentDirection = direction.left;
             }
             break;
         case direction.left:
             if (timer < time)
             {
                 timer += Time.deltaTime;
                 this.transform.Translate(Vector2.left * speed * Time.deltaTime);
             }
             else
             {
                 timer = 0f;
                 currentDirection = direction.right;
             }
             break;
         case direction.up:
             if (timer < time)
             {
                 timer += Time.deltaTime;
                 this.transform.Translate(Vector2.up * speed * Time.deltaTime);
             }
             else
             {
                 timer = 0f;
                 currentDirection = direction.down;
             }
             break;
         case direction.down:
             if (timer < time)
             {
                 timer += Time.deltaTime;
                 this.transform.Translate(Vector2.down * speed * Time.deltaTime);
             }
             else
             {
                 timer = 0f;
                 currentDirection = direction.up;
             }
             break;
     }
 }
开发者ID:jfcarocota,项目名称:MarioProject,代码行数:54,代码来源:movePlatform.cs


示例19: Move

 public void Move(int i, direction dir)
 {
     if (dir == direction.RIGHT)
         x = x + i;
     else if (dir == direction.LEFT)
         x = x - i;
     else if (dir == direction.DOWN)
         y = y + i;
     else if (dir == direction.UP)
         y = y - 1;
 }
开发者ID:Ihor01,项目名称:snake,代码行数:11,代码来源:point.cs


示例20: SwayBar

        public SwayBar(bool usepercent = false)
            : base()
        {
            this.usepercent = usepercent;

            this.bar = "|                         |";
            this.pointer = "***";
            this.blankPointer = this.BlankPointer();
            this.currdir = direction.right;
            this.counter = 1;
        }
开发者ID:SchwarzerLoewe,项目名称:Ecmd,代码行数:11,代码来源:SwayBar.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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