本文整理汇总了C#中Pos类的典型用法代码示例。如果您正苦于以下问题:C# Pos类的具体用法?C# Pos怎么用?C# Pos使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Pos类属于命名空间,在下文中一共展示了Pos类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Foo
public void Foo(Pos pos)
{
if(pos.ToString() == "First")
{
}
}
示例2: Main
public void Main(string[] args)
{
var input = File.ReadAllText("input.txt").ToCharArray();
var houses = new List<string>();
var santaPos = new Pos(0, 0);
var roboSantaPos = new Pos(0, 0);
var curPos = santaPos;
bool isSanta = true;
foreach (var direction in input)
{
curPos = isSanta ? santaPos : roboSantaPos;
houses.Add(curPos.ToString());
Move(curPos, direction);
houses.Add(curPos.ToString());
isSanta = !isSanta;
}
var uniquehouses = houses.Distinct().Count();
}
示例3: f
void f()
{
int[] clients = m.AllPlayers();
foreach (int p in clients)
{
if (p == ghost)
{
continue;
}
Pos pos = new Pos();
pos.x = m.GetPlayerPositionX(p);
pos.y = m.GetPlayerPositionY(p);
pos.z = m.GetPlayerPositionZ(p);
pos.heading = m.GetPlayerHeading(p);
pos.pitch = m.GetPlayerPitch(p);
history.Add(pos);
}
if (history.Count < 20)
{
return;
}
Pos p1 = history[0];
history.RemoveAt(0);
m.SetPlayerPosition(ghost, p1.x, p1.y, p1.z);
m.SetPlayerOrientation(ghost, p1.heading, p1.pitch, 0);
}
示例4: Open
/// <summary>
/// Opens the menu.
/// </summary>
/// <param name="pos">Unused.</param>
public void Open(Pos pos)
{
IsHidden = false;
BringToFront();
Point mouse = Input.InputHandler.MousePosition;
SetPosition(mouse.X, mouse.Y);
}
示例5: CreateDome
public void CreateDome(Player p, byte type, DomeType domeType, ushort radius)
{
List<Pos> buffer = new List<Pos>();
Level level = p.level;
ushort cx = (ushort)(p.pos[0] / 32), cy = (ushort)(p.pos[1] / 32), cz = (ushort)(p.pos[2] / 32);
ushort sx = (ushort)(cx - radius - 1), sy = (ushort)(cy - radius - 1), sz = (ushort)(cz - radius - 1), ex = (ushort)(cx + radius + 1), ey = (ushort)(cy + radius + 1), ez = (ushort)(cz + radius + 1);
if (domeType == DomeType.Hollow)
{
for (ushort x = sx; x < ex; x++)
for (ushort y = sy; y < ey; y++)
for (ushort z = sz; z < ez; z++)
if (Math.Round(Distance(cx, cy, cz, x, y, z)) == radius)
if (level.GetTile(x, y, z) != type)
{
Pos pos = new Pos(); pos.x = x; pos.y = y; pos.z = z;
buffer.Add(pos);
}
}
else if (domeType == DomeType.Solid)
{
for (ushort x = sx; x < ex; x++)
for (ushort y = sy; y < ey; y++)
for (ushort z = sz; z < ez; z++)
if (Math.Round(Distance(cx, cy, cz, x, y, z)) <= radius)
if (level.GetTile(x, y, z) != type)
{
Pos pos = new Pos(); pos.x = x; pos.y = y; pos.z = z;
buffer.Add(pos);
}
}
Execute(p, buffer, type);
}
示例6: ParsingFrame
/// <summary> To create a ParsingFrame object.</summary>
/// <param name="module">the module name.
/// </param>
/// <param name="ind">the index of the character within the source.
/// </param>
/// <param name="pos">the position of the character.
/// </param>
/// <param name="parser">the parser executed.
/// </param>
public ParsingFrame(string module, int ind, Pos pos, Parser parser)
{
this.ind = ind;
this.module = module;
this.parser = parser;
this.pos = pos;
}
示例7: getSpaceType
public SpaceType getSpaceType( Pos pos )
{
if ((pos.x > (width - 1)) || (pos.x < 0) || (pos.y > (height - 1)) || (pos.y < 0))
return SpaceType.Empty;
return spaces[pos.x, pos.y];
}
示例8: SetupChildDock
/// <summary>
/// Initializes an inner docked control for the specified position.
/// </summary>
/// <param name="pos">Dock position.</param>
protected virtual void SetupChildDock(Pos pos)
{
if (m_DockedTabControl == null)
{
m_DockedTabControl = new DockedTabControl(this);
m_DockedTabControl.TabRemoved += OnTabRemoved;
m_DockedTabControl.TabStripPosition = Pos.Bottom;
m_DockedTabControl.TitleBarVisible = true;
}
Dock = pos;
Pos sizeDir;
if (pos == Pos.Right) sizeDir = Pos.Left;
else if (pos == Pos.Left) sizeDir = Pos.Right;
else if (pos == Pos.Top) sizeDir = Pos.Bottom;
else if (pos == Pos.Bottom) sizeDir = Pos.Top;
else throw new ArgumentException("Invalid dock", "pos");
if (m_Sizer != null)
m_Sizer.Dispose();
m_Sizer = new Resizer(this);
m_Sizer.Dock = sizeDir;
m_Sizer.ResizeDir = sizeDir;
m_Sizer.SetSize(2, 2);
}
示例9: CreatePyramid
public void CreatePyramid(Player p, byte type, PyramidType pyramidType, ushort radius, ushort verticalExpansion)
{
List<Pos> buffer = new List<Pos>();
Level level = p.level;
ushort cx = (ushort)(p.pos[0] / 32), cy = (ushort)((p.pos[1] / 32) - 1), cz = (ushort)(p.pos[2] / 32);
ushort sx = (ushort)(cx - radius - 1), sy = cy, sz = (ushort)(cz - radius - 1), ex = (ushort)(cx + radius + 1), ey = (ushort)(cy + (radius * verticalExpansion)), ez = (ushort)(cz + radius + 1);
Pos pos = new Pos(); pos.x = cx; pos.y = ey; pos.z = cz;
for (ushort iy = 0; iy < verticalExpansion; iy++)
for (ushort ix = cx; ix > (ushort)(cx - 2); ix--)
for (ushort iz = cz; iz > (ushort)(cz - 2); iz--)
if (level.GetTile(ix, (ushort)(ey + iy), iz) != type)
{
pos.x = ix; pos.y = (ushort)(ey + iy); pos.z = iz;
buffer.Add(pos);
}
int temp = 0;
if (pyramidType == PyramidType.Hollow)
{
for (ushort y = sy; y < ey; y++)
{
for (ushort x = sx; x < ex; x++)
for (ushort z = sz; z < ez; z++)
if (x == sx || x == (ushort)(ex - 1) || z == sz || z == (ushort)(ez - 1))
if (level.GetTile(x, y, z) != type)
{
pos.x = x; pos.y = y; pos.z = z;
buffer.Add(pos);
}
temp++;
if (temp == verticalExpansion)
{
temp = 0;
sx += 1; ex -= 1;
sz += 1; ez -= 1;
}
}
}
else if (pyramidType == PyramidType.Solid)
{
for (ushort y = sy; y < ey; y++)
{
for (ushort x = sx; x < ex; x++)
for (ushort z = sz; z < ez; z++)
if (level.GetTile(x, y, z) != type)
{
pos.x = x; pos.y = y; pos.z = z;
buffer.Add(pos);
}
temp++;
if (temp == verticalExpansion)
{
temp = 0;
sx += 1; ex -= 1;
sz += 1; ez -= 1;
}
}
}
Execute(p, buffer, type);
}
示例10: GetCharacterPos
public Pos GetCharacterPos(Vector2 characterPos)
{
Vector2 characterPosWorld = rectangleToWorld (characterPos);
Pos returnPos = new Pos ();
returnPos.posX = (int)characterPosWorld.x;
returnPos.posY = (int)characterPosWorld.y;
return returnPos;
}
示例11: Resizer
/// <summary>
/// Initializes a new instance of the <see cref="Resizer"/> class.
/// </summary>
/// <param name="parent">Parent control.</param>
public Resizer(ZGE.Components.ZComponent parent)
: base(parent)
{
m_ResizeDir = Pos.Left;
MouseInputEnabled = true;
SetSize(6, 6);
Target = parent as GUIControl;
}
示例12: CheckTargetInRange
public bool CheckTargetInRange(Pos selfPos, Pos targetPos, int rangeGrid)
{
if (selfPos.posX - rangeGrid <= targetPos.posX && targetPos.posX <= selfPos.posX + rangeGrid && selfPos.posY - rangeGrid <= targetPos.posY && targetPos.posY <= selfPos.posY + rangeGrid) {
return true;
} else {
return false;
}
}
示例13: Resizer
/// <summary>
/// Initializes a new instance of the <see cref="Resizer"/> class.
/// </summary>
/// <param name="parent">Parent control.</param>
public Resizer(Controls.Control parent)
: base(parent)
{
m_ResizeDir = Pos.Left;
MouseInputEnabled = true;
SetSize(6, 6);
Target = parent;
}
示例14: CreateCone
public void CreateCone(Player p, byte type, ConeType coneType, ushort radius, ushort verticalExpansion)
{
List<Pos> buffer = new List<Pos>();
Level level = p.level;
ushort cx = (ushort)(p.pos[0] / 32), cy = (ushort)((p.pos[1] / 32) - 1), cz = (ushort)(p.pos[2] / 32);
ushort sx = (ushort)(cx - radius - 1), sy = cy, sz = (ushort)(cz - radius - 1), ex = (ushort)(cx + radius + 1), ey = (ushort)(cy + (radius * verticalExpansion)), ez = (ushort)(cz + radius + 1);
ushort tempRadius = radius;
Pos pos = new Pos(); pos.x = cx; pos.y = ey; pos.z = cz;
for (ushort i = 0; i < verticalExpansion; i++)
if (level.GetTile(cx, (ushort)(ey + i), cz) != type)
{
pos.y = (ushort)(ey + i);
buffer.Add(pos);
}
int temp = 0;
if (coneType == ConeType.Hollow)
{
for (ushort y = sy; y < ey; y++)
{
for (ushort x = sx; x < ex; x++)
for (ushort z = sz; z < ez; z++)
if (Math.Round(Distance(cx, y, cz, x, y, z)) == tempRadius)
if (level.GetTile(x, y, z) != type)
{
pos.x = x; pos.y = y; pos.z = z;
buffer.Add(pos);
}
temp++;
if (temp == verticalExpansion)
{
temp = 0;
tempRadius--;
}
}
}
else if (coneType == ConeType.Solid)
{
for (ushort y = sy; y < ey; y++)
{
for (ushort x = sx; x < ex; x++)
for (ushort z = sz; z < ez; z++)
if (Math.Round(Distance(cx, y, cz, x, y, z)) <= tempRadius)
if (level.GetTile(x, y, z) != type)
{
pos.x = x; pos.y = y; pos.z = z;
buffer.Add(pos);
}
temp++;
if (temp == verticalExpansion)
{
temp = 0;
tempRadius--;
}
}
}
Execute(p, buffer, type);
}
示例15: Template1
public void Template1(Pos pos)
{
if (pos.ToString() == "First")
{
}
Bar(() => Console.Write(pos.ToString() == "First"));
}