本文整理汇总了C#中Pathfinding.Node.ChangeTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Node.ChangeTexture方法的具体用法?C# Node.ChangeTexture怎么用?C# Node.ChangeTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pathfinding.Node
的用法示例。
在下文中一共展示了Node.ChangeTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
protected override void Update(GameTime gameTime)
{
timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000;
timerInt = (int)timer;
if (timerInt >= 5)
{
//Character p = new Character(this, new Vector3(1.25f, 0, 1.25f), new Vector3(0, 90, 0), new Vector3(0, 1, 0), ImageLibrary.getInstance().getImage("Player"), cam, path.origin);
//enemys.Add(p);
timer = 0;
}
this.keyboard.Update();
enemysArray = enemys.ToArray();
//Erro ao utilizar foreach no Update. Melhor Solução foi esta.
for (int i = 0; i < enemysArray.Length; i++)
{
enemysArray[i].Update(gameTime);
}
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
if (this.keyboard.IsKeyDown(Keys.P))
{
Random rand = new Random();
int x = rand.Next(3, 6);
int y = rand.Next(0, 6);
this.path.Search(this.grid.nodes[0, 0], this.grid.nodes[x, y], ref this.grid, this, ref allTrees, ref this.nodePath);
ArrangeNodes(ref this.nodePath);
player.setPosition(new Vector3(0, 1, 0));
player.target = path.origin;
}
if (this.keyboard.IsKeyDown(Keys.Space)) //Ação!
{
if (activeNode.state == nodeState.OPEN)
{
towers.Add(new Tree(this, new Vector3(1, 1, 1), new Vector3(0, 0, 0), new Vector3(activeNode.x * 2.5f, 0, activeNode.y * 2.5f), cam));
}
}
if (this.keyboard.IsKeyDown(Keys.Down))
{
if (activeNode.y < 5)
{
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("Floor"));
int x = activeNode.x;
int y = activeNode.y;
activeNode = grid.nodes[x, y + 1];
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("FloorSelected"));
}
}
if (this.keyboard.IsKeyDown(Keys.Up))
{
if (activeNode.y > 0)
{
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("Floor"));
int x = activeNode.x;
int y = activeNode.y;
activeNode = grid.nodes[x, y - 1];
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("FloorSelected"));
}
}
if (this.keyboard.IsKeyDown(Keys.Right))
{
if (activeNode.x < 5)
{
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("Floor"));
int x = activeNode.x;
int y = activeNode.y;
activeNode = grid.nodes[x + 1, y];
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("FloorSelected"));
}
}
if (this.keyboard.IsKeyDown(Keys.Left))
{
if (activeNode.x > 0)
{
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("Floor"));
int x = activeNode.x;
int y = activeNode.y;
activeNode = grid.nodes[x - 1, y];
activeNode.ChangeTexture(ImageLibrary.getInstance().getImage("FloorSelected"));
}
}
foreach (Tree currentTree in allTrees)
//.........这里部分代码省略.........