本文整理汇总了C#中System.Coord类的典型用法代码示例。如果您正苦于以下问题:C# Coord类的具体用法?C# Coord怎么用?C# Coord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Coord类属于System命名空间,在下文中一共展示了Coord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Shard
public Shard(Coord ul, Coord ur, Coord ll, Coord lr)
{
_ul = ul;
_ur = ur;
_ll = ll;
_lr = lr;
}
示例2: InitialiseInhab
private static void InitialiseInhab(Inhabitant thing,Room room,AMaterialStats stats)
{
int trytimes = 0;
bool done = false;
Coord size = new Coord(3, 3);
while (!done && trytimes < 20)
{
//Random distribution HACK! u can make more distribution types
int tryx = MyRandom.Random.Next(0, room.RoomOccupiedGrid.GetLength(0) - size.X);
int tryy = MyRandom.Random.Next(0, room.RoomOccupiedGrid.GetLength(1) - size.Y);
if (CheckClear(new Coord(tryx, tryy), size,room.RoomOccupiedGrid))
{
MakeNotCLear(new Coord(tryx, tryy), size, room.RoomOccupiedGrid);
thing.Initialise(size - new Coord(1, 1)
, room.Position + (new Vector2(tryx+1.5f, tryy+1.5f)*Globals.SmallGridSize)
, room.RoomAmbient.RoomColour, room.RoomAmbient.GlowColour, stats
, room.RoomAmbient.RoomTileset);
done = true;
}
trytimes++;
}
}
示例3: Main
private static void Main()
{
var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
var n = input[0];
var coord0 = new Coord(input[1], input[2]);
var rgcoord = new HashSet<Coord>();
for (var i = 0; i < n; i++)
{
input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
rgcoord.Add(new Coord(input[0], input[1]));
}
var d = 0;
while (rgcoord.Any())
{
d++;
var coord = rgcoord.First();
var vX = coord.x - coord0.x;
var vY = coord.y - coord0.y;
foreach (var coordT in rgcoord.ToList())
{
if (vY*(coordT.x - coord0.x) == vX*(coordT.y - coord0.y))
rgcoord.Remove(coordT);
}
}
Console.WriteLine(d);
}
示例4: DrawTargetMark
private static void DrawTargetMark(Unit currentUnit, Coord target, bool toShow)
{
if (toShow)
{
ZBuffer.ReadBuffer("targetBuffer", target.X, target.Y, 3, 3);
var buffer = ZBuffer.BackupBuffer("defaultBuffer");
ZIOX.OutputType = ZIOX.OutputTypeEnum.Buffer;
ZIOX.BufferName = "defaultBuffer";
var targetColor = IsTargetOnSoldier(currentUnit, target) ? Color.Yellow : Color.Cyan;
ZIOX.Print(target.X-1, target.Y-1, (char)Tools.Get_Ascii_Byte('┌'), targetColor);
ZIOX.Print(target.X+1, target.Y-1, (char)Tools.Get_Ascii_Byte('┐'), targetColor);
ZIOX.Print(target.X-1, target.Y+1, (char)Tools.Get_Ascii_Byte('└'), targetColor);
ZIOX.Print(target.X+1, target.Y+1, (char)Tools.Get_Ascii_Byte('┘'), targetColor);
MapRender.DrawVisibleUnits(currentUnit);
ZIOX.OutputType = ZIOX.OutputTypeEnum.Direct;
ZBuffer.WriteBuffer("defaultBuffer", UIConfig.GameAreaRect.Left, UIConfig.GameAreaRect.Top);
ZBuffer.SaveBuffer("defaultBuffer", buffer);
}
else
{
ZBuffer.WriteBuffer("targetBuffer", target.X, target.Y);
}
}
示例5: DoTargetAction
public static Coord DoTargetAction(Unit unit)
{
var exitFlag = false;
var target = new Coord(unit.Position.X, unit.Position.Y);
DrawTargetMark(unit, target, true);
while (!exitFlag)
{
var key = ZInput.ReadKey();
var oldTarget = new Coord(target.X, target.Y);
switch (key)
{
case ConsoleKey.LeftArrow : MoveTarget(target, -1, 0); break;
case ConsoleKey.RightArrow : MoveTarget(target, +1, 0); break;
case ConsoleKey.UpArrow : MoveTarget(target, 0, -1); break;
case ConsoleKey.DownArrow : MoveTarget(target, 0, +1); break;
case ConsoleKey.Enter : return target; break;
case ConsoleKey.Escape : exitFlag = true; break;
}
if (!oldTarget.Equals(target))
{
DrawTargetMark(unit, oldTarget, false);
DrawTargetMark(unit, target, true);
}
}
return null;
}
示例6: Room
public Room(Coord aTopLeft, int aHeight, int aWidth, Direction aDirection)
{
iTopLeft = aTopLeft;
iHeight = aHeight;
iWidth = aWidth;
iDoorLocation = aDirection;
}
示例7: DFS
private static void DFS(Coord coord, Coord target, long sum, int[,] lab)
{
//if (!visited.Contains(coord))
//{
visited.Add(coord);
if (coord.Equals(target))
{
results.Add(sum);
return;
}
if (lab[coord.X, coord.Y] == 1)
{
sum += 1;
}
if (coord.X + 1 < lab.GetLength(0))
{
DFS(new Coord(coord.X + 1, coord.Y), target, sum, lab);
}
if (coord.Y + 1 < lab.GetLength(1))
{
DFS(new Coord(coord.X, coord.Y + 1), target, sum, lab);
}
//}
}
示例8: Pieces
protected Pieces(string name, Couleur couleur, Coord coord)
{
Name = name;
Couleur = couleur;
Coord = coord;
Depart = true;
Captured = false;
}
示例9: FlamingLongSword
public FlamingLongSword(string name = "Flaming Long Sword", Coord position = new Coord())
: base(name,
position: position,
specialAttack: Weapon.WeaponSpecialAttacks.Flaming,
specialAttackDescription: Weapon.WeaponSpecialAttacks.Flaming.WeaponDescription())
{
}
示例10: StackItemTest
public StackItemTest( Color color = new Color(),
string description = "Stackable Item",
Coord position = new Coord(),
int uses = _UnlimitedUses)
:base("Stack Item", "s", color: color, cost: 1, description: description, position: position, uses: uses)
{
}
示例11: ShardSet
public ShardSet(Coord ul, Coord lr, int n)
{
var ur = new Coord(ul.X, lr.Y);
var ll = new Coord(lr.X, ul.Y);
_set = Split(new Shard(ul, ur, ll, lr), n);
Console.WriteLine("n: " + n);
Console.WriteLine("#shards: " + _set.Count);
}
示例12: IsTargetOnSoldier
public static bool IsTargetOnSoldier(Unit currentUnit, Coord target)
{
foreach (var team in MainGame.Teams)
foreach (var unit in team.Units.Where(a => a.Name != currentUnit.Name))
if (target.Equals(unit.Position))
return true;
return false;
}
示例13: GenerateByBuilderType
public static Item GenerateByBuilderType( Type type,
Pg.Level level = Pg.Level.Novice,
Coord position = new Coord())
{
return Generators.ContainsKey(type)
? Generators[type].GenerateRandom(level, position)
: null;
}
示例14: Render
public byte[] Render(Coord coord, string format, int tileWidth, int tileHeight)
{
ProxyProvider proxy;
if (!this._proxyDictionary.TryGetValue(format.ToString(), out proxy))
throw new InvalidTileFormatException(
string.Format("Invalid tile FORMAT {0}", format)
);
return proxy.Render(coord, format, tileWidth, tileHeight);
}
示例15: Wall
public Wall(Coord position)
: base("Wall",
"█",
Color.LightGray,
false,
true,
"A rock wall",
position)
{
}