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


C# Figure类代码示例

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


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

示例1: Add

	//-----------------------------------------------------------------------------------------------
	
	public void Add(Figure figure)
	{
		for (int y = 0; y < figure.form.GetLength(0); y++)
			for (int x = 0; x < figure.form.GetLength(1); x++)
				if (figure.form[y, x] && y+figure.position.Y>=0)
					this.cells[y + figure.position.Y, x + figure.position.X] = true;
	}
开发者ID:PavelKlim,项目名称:Tetris-Unity,代码行数:9,代码来源:Model.cs

示例2: ExecuteFigureCreationCommand

        public virtual void ExecuteFigureCreationCommand(string[] splitFigString)
        {
            switch (splitFigString[0])
            {
                case "vertex":
                    {
                        Vector3D location = Vector3D.Parse(splitFigString[1]);
                        currentFigure = new Vertex(location);
                        break;
                    }
                case "segment":
                    {
                        Vector3D a = Vector3D.Parse(splitFigString[1]);
                        Vector3D b = Vector3D.Parse(splitFigString[2]);
                        currentFigure = new LineSegment(a, b);
                        break;
                    }
                case "triangle":
                    {
                        Vector3D a = Vector3D.Parse(splitFigString[1]);
                        Vector3D b = Vector3D.Parse(splitFigString[2]);
                        Vector3D c = Vector3D.Parse(splitFigString[3]);
                        currentFigure = new Triangle(a, b, c);
                        break;
                    }
            }

            this.EndCommandExecuted = false;
        }
开发者ID:deyantodorov,项目名称:TelerikAcademy,代码行数:29,代码来源:FigureController.cs

示例3: Main

 static void Main()
 {
     Figure fig = new Figure(3, 2);
     fig = fig.Rotate(fig, 30);
     Console.WriteLine(fig.Width);
     Console.WriteLine(fig.Height);
 }
开发者ID:GStoykov,项目名称:TelerikAcademyHomeworks,代码行数:7,代码来源:Program.cs

示例4: SquareItem

 public SquareItem(Square square, Figure figure, Color color)
 {
     this.innerSquare = square;
     this.SetBackgroundColor(square);
     this.FigureType = figure;
     this.FigureColor = color;
     this.ColoredFigure = ColoredFigureHelper.Create(color, figure);
 }
开发者ID:Ribtoks,项目名称:Queem,代码行数:8,代码来源:SquareItem.cs

示例5: Hit

 public void Hit(Figure newFig)
 {
     this.figure.x = newFig.x;
     this.figure.y = newFig.y;
     Console.WriteLine("Figure is hit");
     newFig.changeAbToMove();
     Console.WriteLine("New current koords are x:" + this.figure.x + ", y:" + this.figure.y);
 }
开发者ID:Artui,项目名称:Labs,代码行数:8,代码来源:Queen.cs

示例6: Reset

 /// <summary>
 /// Resets the original setup
 /// </summary>
 public static void Reset()
 {
     hasToGoBackwards = false;
     turnIsRunning = false;
     currentFigure = null;
     currentStep = 0;
     lastStep = 0;
 }
开发者ID:Kussi,项目名称:Myosotis,代码行数:11,代码来源:TurnCtrl.cs

示例7: Rotate

 public Figure Rotate(Figure figure, double angleForRotate)
 {
     double newWidth = Math.Abs(Math.Cos(angleForRotate)) * figure.Width +
         Math.Abs(Math.Sin(angleForRotate)) * figure.Height;
     double newHeight = Math.Abs(Math.Sin(angleForRotate)) * figure.Width +
         Math.Abs(Math.Cos(angleForRotate)) * figure.Height;
     figure = new Figure(newWidth, newHeight);
     return figure;
 }
开发者ID:GStoykov,项目名称:TelerikAcademyHomeworks,代码行数:9,代码来源:Figure.cs

示例8: GetRotatedSize

        public static Figure GetRotatedSize(Figure figure, double angleToRotateInDegree)
        {
            double angle = angleToRotateInDegree;

            double rotatedWidth = Math.Abs(Math.Cos(angle)) * figure.Width + Math.Abs(Math.Sin(angle)) * figure.Height;
            double rotatedHeight = Math.Abs(Math.Sin(angle)) * figure.Width + Math.Abs(Math.Cos(angle)) * figure.Height;

            return new Figure(rotatedWidth, rotatedHeight);
        }
开发者ID:NikolaNikushev,项目名称:Lectures,代码行数:9,代码来源:Excercise1FigureAndSize.cs

示例9: Main

 static void Main()
 {
     Figure figure = new Figure(1, 2);
     figure.Width = -6;
     Console.WriteLine(figure.Width);
     figure = Figure.GetRotatedFigure(figure, 5);
     Console.WriteLine(figure.Width);
     Console.WriteLine(figure.Height);
 }
开发者ID:hristo11111,项目名称:TelerikAcademy-HristoBratanov,代码行数:9,代码来源:Test.cs

示例10: Main

        public static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            Figure original = new Figure(2, 5);
            PrintFigureWidthAndHeight(original);

            Figure rotated = Figure.GetRotatedFigure(original, 90);
            PrintFigureWidthAndHeight(rotated);
        }
开发者ID:bankova,项目名称:HighQualityCode,代码行数:10,代码来源:Test.cs

示例11: GetFigureToSendHome

 /// <summary>
 /// Return a gamefigure if there is one to send home. otherwise null is returned
 /// </summary>
 /// <param name="figure"></param>
 /// <returns></returns>
 public Figure GetFigureToSendHome(Figure figure)
 {
     if (isBench) return null;
     ArrayList figuresOnField = GetFiguresOnField();
     if (figuresOnField.Count == 0) return null;
     Figure figureToSendHome = (Figure)figuresOnField[0];
     if (FigureCtrl.GetPlayer(figureToSendHome).Color.Equals(FigureCtrl.GetPlayer(figure).Color))
         return null;
     return figureToSendHome;
 }
开发者ID:Kussi,项目名称:Myosotis,代码行数:15,代码来源:RegularField.cs

示例12: RotateFigure

    public static Figure RotateFigure(Figure currentFigure, double rotationAngleInRadians)
    {
        double rotatedWidth = Math.Abs(Math.Cos(rotationAngleInRadians)) * currentFigure.Width +
            Math.Abs(Math.Sin(rotationAngleInRadians)) * currentFigure.Height;
        double rotatedHeight = Math.Abs(Math.Sin(rotationAngleInRadians)) * currentFigure.Width +
            Math.Abs(Math.Cos(rotationAngleInRadians)) * currentFigure.Height;
        Figure rotatedFigure = new Figure(rotatedWidth, rotatedHeight);

        return rotatedFigure;
    }
开发者ID:vasilkrvasilev,项目名称:QualityCode,代码行数:10,代码来源:Figure.cs

示例13: GetRotatedFigure

    public static Figure GetRotatedFigure(Figure figure, double angleOfRotation)
    {
        double rotatedSizeWidth = (Math.Abs(Math.Cos(angleOfRotation)) * figure.Width) +
            (Math.Abs(Math.Sin(angleOfRotation)) * figure.Heigth);
        double rotatedSizeHeight = (Math.Abs(Math.Sin(angleOfRotation)) * figure.Width) +
            (Math.Abs(Math.Cos(angleOfRotation)) * figure.Heigth);

        Figure rotatedFigure = new Figure(rotatedSizeWidth, rotatedSizeHeight);

        return rotatedFigure;
    }
开发者ID:bankova,项目名称:HighQualityCode,代码行数:11,代码来源:Figure.cs

示例14: ShowRandomText

 /// <summary>
 /// fetches a text randomly and displays it
 /// </summary>
 /// <param name="figure"></param>
 public static void ShowRandomText(Figure figure)
 {
     if (isActive)
     {
         if (notYetDisplayedTexts.Count == 0)
             notYetDisplayedTexts.AddRange(texts);
         int randomIndex = UnityEngine.Random.Range(0, notYetDisplayedTexts.Count);
         string text = (string)notYetDisplayedTexts[randomIndex];
         ShowText(figure, text);
         notYetDisplayedTexts.Remove(text);
     }
 }
开发者ID:Kussi,项目名称:Myosotis,代码行数:16,代码来源:TextCtrl.cs

示例15: Clone

 public object Clone()
 {
     var copied = new Figure(this.Body);
     copied.Elements = GetFigureFromArray(copied.Body);
     copied.Position = this.Position;
     for (int i = 0; i < copied.Elements.Count; i++)
     {
         copied.Elements[i].Position.Left = this.Elements[i].Position.Left;
         copied.Elements[i].Position.Top = this.Elements[i].Position.Top;
     }
     return copied;
 }
开发者ID:sirjordan,项目名称:CSharp,代码行数:12,代码来源:Figure.cs


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