59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
|
|
|
|
using System.Diagnostics;
|
|
namespace Debug.MinLong;
|
|
|
|
#pragma warning disable CS8981 // 该类型名称仅包含小写 ascii 字符。此类名称可能会成为该语言的保留值。
|
|
public class Zhangaiwu
|
|
{
|
|
private static int SleepTime = 100;
|
|
public static void Newshitou(Main.XiaoLong xiaoLong)
|
|
{
|
|
var y = Program.chars.GetLength(0);
|
|
var x = Program.chars.GetLength(1);
|
|
var shitou = new Shitou
|
|
{
|
|
x = x - 1,
|
|
y = y - 1
|
|
};
|
|
bool isjiafeng = false;//是否加分
|
|
for (int i = 1; i < x; i++)
|
|
{
|
|
// System.Diagnostics.Debug.WriteLine("shitou");
|
|
// //测试 自动跳跃
|
|
// if (!xiaoLong.istiao && shitou.x == xiaoLong.x + Program.random.Next(1, 2))
|
|
// {
|
|
// new Thread(() => Main.tiaoyue(xiaoLong)).Start();
|
|
// }
|
|
if (shitou.x != xiaoLong.x || shitou.y != xiaoLong.y)
|
|
{
|
|
Program.chars[shitou.y, shitou.x].Char = '0';
|
|
if (shitou.x < xiaoLong.x && !isjiafeng)
|
|
{
|
|
isjiafeng = true;
|
|
xiaoLong.score++;
|
|
if (SleepTime > 20) SleepTime--;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Program.IsWhile = false;
|
|
}
|
|
Thread.Sleep(SleepTime);
|
|
if (shitou.x == xiaoLong.x && shitou.y == xiaoLong.y)
|
|
{
|
|
Program.IsWhile = false;
|
|
}
|
|
Program.chars[shitou.y, shitou.x].Char = Program.ShowChar;
|
|
--shitou.x;
|
|
}
|
|
}
|
|
|
|
|
|
public class Shitou
|
|
{
|
|
public int x;
|
|
public int y;
|
|
public char Char = '0';
|
|
}
|
|
} |