当前位置: 首页>>代码示例>>C#>>正文


C# Ability.GenerateTargetGrid方法代码示例

本文整理汇总了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;
                };
        }
开发者ID:HaKDMoDz,项目名称:armadillo,代码行数:58,代码来源:BattleScene.cs

示例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)
     );
 }
开发者ID:HaKDMoDz,项目名称:armadillo,代码行数:13,代码来源:BattleScene.cs


注:本文中的Ability.GenerateTargetGrid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。