本文整理汇总了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;
}
示例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;
}
示例3: Main
static void Main()
{
Figure fig = new Figure(3, 2);
fig = fig.Rotate(fig, 30);
Console.WriteLine(fig.Width);
Console.WriteLine(fig.Height);
}
示例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);
}
示例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);
}
示例6: Reset
/// <summary>
/// Resets the original setup
/// </summary>
public static void Reset()
{
hasToGoBackwards = false;
turnIsRunning = false;
currentFigure = null;
currentStep = 0;
lastStep = 0;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}