本文整理汇总了C#中TileData.GetConnectedTiles方法的典型用法代码示例。如果您正苦于以下问题:C# TileData.GetConnectedTiles方法的具体用法?C# TileData.GetConnectedTiles怎么用?C# TileData.GetConnectedTiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileData
的用法示例。
在下文中一共展示了TileData.GetConnectedTiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleTileEvent
//.........这里部分代码省略.........
"Cave",
"You captured the cave and made it part of your empire!",
true);
}
CardData c =_CardSystem.GetRandomCard(_AvailableCaveCards.cards);
_GameStateHolder._ActivePlayer.AddCard(c);
_Board.SetTileOwner(tile, _GameStateHolder._ActivePlayer.Type);
Unit prisoner = _GameStateHolder._ActivePlayer.PlayerArmy.GetDefendingUnit(tile);
if (prisoner != null) {
_Board.UnsetTilePrisoner(tile);
PromptForReturnPrisoner(_GameStateHolder._ActivePlayer, prisoner, tile, p, endTurn);
} else if (_GameStateHolder._ActivePlayer.PlayerArmy.GetActiveUnits().Count > 1) {
StartCoroutine(PromptForDefendingUnit("You enter the cave, there's no sign of the enemy. Leave a unit to defend this cave?", _GameStateHolder._ActivePlayer, p, endTurn));
} else {
endTurn();
}
} else {
if (tile.IsDefended ()) {
Unit defendingUnit = _GameStateHolder._ActivePlayer.PlayerArmy.GetDefendingUnit (tile);
p.ShowOKCancel("Take back unit", "Should this " + defendingUnit.Type + " stop defending this cave?", () =>
StartCoroutine(PromptToReplaceDefendingUnit (_GameStateHolder._ActivePlayer, defendingUnit, p, endTurn)),
endTurn);
} else {
if (_GameStateHolder._ActivePlayer.PlayerArmy.GetActiveUnits().Count > 1) {
StartCoroutine(PromptForDefendingUnit ("Your land is undefended. Would you like to leave a unit to defend this cave?", _GameStateHolder._ActivePlayer, p, endTurn));
} else {
endTurn ();
}
}
}
break;
case BuildingType.Fortress:
bool ownsSurroundingTiles = tile.GetConnectedTiles().FindAll(t => t.Owner == _GameStateHolder._ActivePlayer.Type).Count >= 3;
if (!_GameStateHolder._ActivePlayer.LandedFortress) {
_GameStateHolder._ActivePlayer.LandedFortress = true;
TutorialPanel.Instance().Tutor(_GameStateHolder._ActivePlayer.Type,
"Fortress",
"This fortress seems eerie. It looks like there are many like it around Nekark.",
true);
if (!ownsSurroundingTiles) {
TutorialPanel.Instance().Tutor(_GameStateHolder._ActivePlayer.Type,
"Fortress",
"I suggest securing the surrounding area!",
false);
}
}
// Make sure that the fortress type matches the player type
if (tile.Owner == _GameStateHolder._ActivePlayer.Type) {
// make sure the player owns at least 3 surrounding tiles
if (ownsSurroundingTiles) {
// Battle lost immortal
p.ShowOK("Fortress", "A bloody Lost Immortal just showed up innit blud!", () => {
startBattle(BattleType.LostImmortal);
});
} else {
p.ShowOK ("Fortress", "You felt a chill in the air, but nothing appeared.", endTurn);
}
break;
}
endTurn();
break;
case BuildingType.Inn:
if(!_GameStateHolder._ActivePlayer.LandedInn) {
_GameStateHolder._ActivePlayer.LandedInn = true;
TutorialPanel.Instance().Tutor(_GameStateHolder._ActivePlayer.Type,
示例2: GetReachableTiles
public HashSet<TileData> GetReachableTiles(Player p, TileData fromTile, int distance)
{
HashSet<TileData> foundTiles = new HashSet<TileData>();
if (distance == 0 || fromTile == null) {
return foundTiles;
}
foreach (TileData t in fromTile.GetConnectedTiles()) {
if (t == p.CommanderPosition) {
continue;
}
if ((p.Type == PlayerType.Battlebeard && t.Building != BuildingType.StartTileStormshaper) || (p.Type == PlayerType.Stormshaper && t.Building != BuildingType.StartTileBattlebeard))
foundTiles.Add(t);
HashSet<TileData> tilesForT = GetReachableTiles(p, t, distance - 1);
foreach (TileData tt in tilesForT) {
//check that thetile is not the oponents start tile
if ((p.Type == PlayerType.Battlebeard && t.Building != BuildingType.StartTileStormshaper) || (p.Type == PlayerType.Stormshaper && t.Building != BuildingType.StartTileBattlebeard))
foundTiles.Add(tt);
}
}
return foundTiles;
}