本文整理汇总了C#中Area.getTileRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Area.getTileRectangle方法的具体用法?C# Area.getTileRectangle怎么用?C# Area.getTileRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Area
的用法示例。
在下文中一共展示了Area.getTileRectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: changeActiveArea
/// <summary>
/// Moves the player from one area to another.
/// </summary>
/// <param name="arrivingArea">New area.</param>
/// <param name="targetTile">Tile in that area the player should appear on.</param>
public static void changeActiveArea(Area arrivingArea, Point targetTile)
{
Area departingArea = GameplayManager.ActiveArea;
if (arrivingArea == departingArea)
return;
departingArea.remove(GameplayManager.Player);
Rectangle targetRectangle = arrivingArea.getTileRectangle(targetTile.X, targetTile.Y);
Vector2 newPos = new Vector2(
targetRectangle.X + arrivingArea.TileSet.tileWidth / 2,
targetRectangle.Y + arrivingArea.TileSet.tileHeight / 2);
Player.getCollider().move(newPos - Player.getCollider().Bounds.Center());
arrivingArea.add(GameplayManager.Player);
activeArea = arrivingArea;
}
示例2: changeActiveArea
/// <summary>
/// Moves the player from one area to another.
/// </summary>
/// <param name="arrivingArea">New area.</param>
/// <param name="targetTile">Tile in that area the player should appear on.</param>
public static void changeActiveArea(Area arrivingArea, Point targetTile)
{
Area departingArea = GameplayManager.ActiveArea;
if (arrivingArea == departingArea)
return;
if (departingArea.exists(GameplayManager.Companion))
{
//GameplayManager.Companion.getCollider().setCollider(ColliderType.PC);
departingArea.remove(GameplayManager.Companion);
}
departingArea.remove(GameplayManager.Player);
Rectangle targetRectangle = arrivingArea.getTileRectangle(targetTile.X, targetTile.Y);
Vector2 newPos = new Vector2(
targetRectangle.X + arrivingArea.TileSet.tileWidth / 2,
targetRectangle.Y + arrivingArea.TileSet.tileHeight / 2);
Player.getCollider().move(newPos - Player.getCollider().Bounds.Center());
if (Quest.talkedToCompanion)
//if(true)
{
Companion.getCollider().move(newPos - Companion.getCollider().Bounds.Center());
((CompanionController)Companion).learnNewInfo(CharacterController.currPlan);
CharacterController.currPlan = null;
//Player.brew.extract(CharacterController.ALL_BREW);
//Companion.brew.extract(CharacterController.ALL_BREW);
}
arrivingArea.add(GameplayManager.Player);
if (!Quest.talkedToCompanion && arrivingArea.Equals(WorldManager.GetArea(Area.START)))
{
arrivingArea.add(GameplayManager.Companion);
//ADD AND ALSO IF FIRST QUEST IS UNDONE!
GameplayManager.Companion.setAbsPos(new Vector2(500, 50));
}
else if(Quest.talkedToCompanion)
{
arrivingArea.add(GameplayManager.Companion);
}
activeArea = arrivingArea;
if (activeArea.GlobalLocation == Area.PARTY)
{
// place the companion and player into new default start locales
double xdiff = GameplayManager.Player.m_position.X - GameplayManager.Player.m_collider.m_bounds.X;
double ydiff = GameplayManager.Player.m_position.Y - GameplayManager.Player.m_collider.m_bounds.Y;
GameplayManager.Player.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 3);
GameplayManager.Player.m_collider.move(new Vector2((float)(-GameplayManager.Player.m_collider.m_bounds.X + GameplayManager.Player.m_position.X - xdiff), (float)(-GameplayManager.Player.m_collider.m_bounds.Y + GameplayManager.Player.m_position.Y - ydiff)));
GameplayManager.Player.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 3);
xdiff = GameplayManager.Companion.m_position.X - GameplayManager.Companion.m_collider.m_bounds.X;
ydiff = GameplayManager.Companion.m_position.Y - GameplayManager.Companion.m_collider.m_bounds.Y;
GameplayManager.Companion.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 9);
GameplayManager.Companion.m_collider.move(new Vector2((float)(-GameplayManager.Companion.m_collider.m_bounds.X + GameplayManager.Companion.m_position.X - xdiff), (float)(-GameplayManager.Companion.m_collider.m_bounds.Y + GameplayManager.Companion.m_position.Y - ydiff)));
GameplayManager.Companion.m_position = new Vector2(Area.TILE_WIDTH * 3 + 20, Area.TILE_HEIGHT * 9);
GameplayManager.Companion.m_collider.m_type = ColliderType.NPC;
}
else
{
GameplayManager.Companion.m_collider.m_type = ColliderType.PC;
}
}