本文整理汇总了C#中System.Windows.Media.PointCollection.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# PointCollection.Contains方法的具体用法?C# PointCollection.Contains怎么用?C# PointCollection.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.PointCollection
的用法示例。
在下文中一共展示了PointCollection.Contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: gotFood
//Metodo que testa se a proxmia posição for comida
public bool gotFood()
{
if (posição.X == Canvas.GetLeft(food) && posição.Y == Canvas.GetTop(food))
{
// Task.Run(() => notificationSound.Play());
Random rnd = new Random();
Console.WriteLine("Pegou a comida");
PointCollection d = new PointCollection();
for (int i = 0; i < rects.Count; i++)
{
d.Add(new Point(Canvas.GetLeft(rects[i]), Canvas.GetTop(rects[i])));
}
int rnd1, rnd2;
//Muda a posição da comida caso não seja dentro da snake
do
{
rnd1 = rnd.Next(30);
rnd2 = rnd.Next(30);
Canvas.SetLeft(food, rnd1 * dimension);
Canvas.SetTop(food, rnd2 * dimension);
}
while (d.Contains(new Point(rnd1 * dimension, rnd2 * dimension)));
return true;
}
return false;
}