本文整理汇总了C#中Ability.GenerateTargetGrid方法的典型用法代码示例。如果您正苦于以下问题:C# Ability.GenerateTargetGrid方法的具体用法?C# Ability.GenerateTargetGrid怎么用?C# Ability.GenerateTargetGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ability
的用法示例。
在下文中一共展示了Ability.GenerateTargetGrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectAbilityTarget
/// <summary>
/// Create a callback function to process if the player chooses to have a character attack. This callback will display the targetting grid
/// and bind _aimAbility to a function that queues an attack command from the character onto the target.
/// </summary>
/// <param name="character">The character whose attack is being chosen.</param>
/// <param name="ability">The ability currently being aimed.</param>
/// <returns></returns>
private void SelectAbilityTarget(Combatant character, Ability ability)
{
_state = BattleState.AimingAbility;
Gui.Screen.Desktop.Children.Remove(_radialMenuControl);
_battleBoardLayer.SetTargettingGrid(
ability.Name == "Move" ?
character.GetMovementGrid(BattleBoard.GetAccessibleGrid(character.Faction)) :
ability.GenerateTargetGrid(BattleBoard.Sandbag.Clone()),
ability.GenerateImpactGrid()
);
_battleBoardLayer.AbilityAim = true;
_aimAbility = (x, y) =>
{
// only target enemies with angry spells and allies with friendly spells
if (!ability.CanTarget(BattleBoard.IsOccupied(new Point(x, y))))
return false;
character.Avatar.UpdateVelocity(x - character.Avatar.Location.X, y - character.Avatar.Location.Y);
character.Avatar.UpdateVelocity(0, 0);
// make sure the ability knows who is casting it. this probably shouldn't
// be done here, but there are issues doing it elsewhere.
ability.Character = character;
var command = new Command
{
Character = character,
Target = new Point(x, y),
Ability = ability
};
if(ability.Name == "Move")
{
ExecuteCommand(command);
return true;
}
character.CanAct = false;
QueuedCommands.Add(command);
_queuedCommands.UpdateControls();
_state = BattleState.Delay;
_delayState = BattleState.PlayerTurn;
_delayTimer = 0.05F;
ResetState();
return true;
};
}
示例2: PreviewAbility
/// <summary>
/// Show a stats panel indicating the name, mana and description of an ability
/// </summary>
/// <param name="ability"></param>
private void PreviewAbility(Ability ability)
{
_abilityStatLayer.SetAbility(ability);
ShowGui(_abilityStatLayer);
_battleBoardLayer.SetTargettingGrid(
ability.GenerateTargetGrid(BattleBoard.Sandbag.Clone()),
new Grid(1, 1)
);
}