本文整理汇总了C#中Pos类的典型用法代码示例。如果您正苦于以下问题:C# Pos类的具体用法?C# Pos怎么用?C# Pos使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pos类属于命名空间,在下文中一共展示了Pos类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Foo
public void Foo(Pos pos)
{
if(pos.ToString() == "First")
{
}
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:7,代码来源:InterceptorsExampleIdeas.cs
示例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();
}
开发者ID:KoalaBear84,项目名称:AdventOfCode2015-1,代码行数:25,代码来源:Program.cs
示例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);
}
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:27,代码来源:Ghost.cs
示例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);
}
开发者ID:jcsnider,项目名称:GWEN.Net-Unity,代码行数:11,代码来源:Menu.cs
示例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);
}
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:32,代码来源:CmdDome.cs
示例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;
}
开发者ID:JuroGandalf,项目名称:Ragnarok,代码行数:16,代码来源:ParsingFrame.cs
示例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];
}
开发者ID:htaunay,项目名称:SmartPacman,代码行数:7,代码来源:Map.cs
示例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);
}
开发者ID:WardBenjamin,项目名称:gwen-dotnet,代码行数:30,代码来源:DockBase.cs
示例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);
}
开发者ID:sillyboyization,项目名称:MCDawn,代码行数:59,代码来源:CmdPyramid.cs
示例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;
}
开发者ID:kazuooooo,项目名称:UnityUtil,代码行数:8,代码来源:GetClosestGameObjectWithTag.cs
示例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;
}
开发者ID:petya2164,项目名称:ZsharpGameEditor,代码行数:12,代码来源:Resizer.cs
示例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;
}
}
开发者ID:kazuooooo,项目名称:UnityUtil,代码行数:8,代码来源:GetClosestGameObjectWithTag.cs
示例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;
}
开发者ID:FloodProject,项目名称:flood,代码行数:12,代码来源:Resizer.cs
示例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);
}
开发者ID:jonnyli1125,项目名称:MCDawn,代码行数:57,代码来源:CmdCone.cs
示例15: Template1
public void Template1(Pos pos)
{
if (pos.ToString() == "First")
{
}
Bar(() => Console.Write(pos.ToString() == "First"));
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:9,代码来源:InterceptorsExampleIdeas.cs
示例16: PString
public PString(string value, int index, int endIndex, Pos pos, Pos defPos, Sidedness side, Option<object> userState)
{
Value = value;
Index = index;
EndIndex = endIndex;
Pos = pos;
DefPos = defPos;
Side = side;
UserState = userState;
}
开发者ID:OlduwanSteve,项目名称:language-ext,代码行数:10,代码来源:PString.cs
示例17: Draw
public void Draw(Pos pos, Center center = Center.None, bool fighting = false)
{
if (fighting)
Tile.Draw("fight/" + IdFloor, pos);
else
{
Tile.Draw("main/" + IdFloor, pos);
if (IdDeco != 0)
Tile.Draw("main deco/" + IdDeco, pos);
}
}
开发者ID:Lyloox,项目名称:Abimn,代码行数:11,代码来源:Cell.cs
示例18: CalculatePath
private string CalculatePath(GameState state, Pos goal)
{
Pos start = state.myHero.pos;
Console.WriteLine("Begining calculating path from ({0},{1}) to ({2},{3})", start.x, start.y, goal.x, goal.y);
try
{
List<Pos> visited = new List<Pos>();
List<PathCoord> availableTiles = new List<PathCoord>();
var first = createPathCoord(start, null, state, goal, null);
availableTiles.Add(first);
while (availableTiles.Any())
{
// Sort availableTiles
availableTiles.Sort((f1, f2) => f1.heuristic.CompareTo(f2.heuristic));
var currentVisited = availableTiles.First();
availableTiles.Remove(currentVisited);
if (visited.Any(x => x.x == currentVisited.current.x && x.y==currentVisited.current.y))
{
continue;
}
// Console.WriteLine("Visiting ({0},{1}) with heuristic {2}", currentVisited.current.x, currentVisited.current.y, currentVisited.heuristic);
visited.Add(currentVisited.current);
if (getDistance(currentVisited.current, goal) == 0)
{
string direction = Restitute(start, currentVisited);
Console.WriteLine("Path found! Going {0}", direction);
return direction;
}
else
{
var spreadFrom = getAvailableCoords(currentVisited, state, goal);
availableTiles.AddRange(spreadFrom);
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.WriteLine("No path found!");
return Direction.Stay;
}
开发者ID:maperr,项目名称:blitz2016,代码行数:52,代码来源:RandomBot.cs
示例19: toErrorStr
static string toErrorStr(ParseError err, Pos? pos)
{
System.Text.StringBuilder buf = new System.Text.StringBuilder();
if (pos.HasValue)
buf.Append("line " + pos.Value.Line + ", column " + pos.Value.Column);
if (err != null)
{
buf.Append(":\n");
showExpecting(buf, err.getExpecting());
showUnexpected(buf, err.getUnexpected());
showMessages(buf, err.getMessages());
showEncountered(buf, err.getEncountered());
}
return buf.ToString();
}
开发者ID:JuroGandalf,项目名称:Ragnarok,代码行数:15,代码来源:DefaultShowError.cs
示例20: UserControl1_MouseDown
private void UserControl1_MouseDown(object sender, MouseEventArgs e)
{
if (e.X >= minPos && e.X <= (maxPos) &&
e.Y >= 100 && e.Y <= 150)
{
pointedPos = Pos.M;
if (e.X <= minPos + 20) pointedPos = Pos.L;
if (e.X >= maxPos - 20) pointedPos = Pos.R;
lastPoint = new Point(e.X, e.Y);
this.Refresh();
}
else
{
pointedPos = Pos.N;
}
}
开发者ID:mundi15,项目名称:M2-IHM,代码行数:16,代码来源:UserControl1.cs
注:本文中的Pos类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论