本文整理匯總了C#中Ability.GenerateImpactGrid方法的典型用法代碼示例。如果您正苦於以下問題:C# Ability.GenerateImpactGrid方法的具體用法?C# Ability.GenerateImpactGrid怎麽用?C# Ability.GenerateImpactGrid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ability
的用法示例。
在下文中一共展示了Ability.GenerateImpactGrid方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
};
}