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


C# GameEntity.AppendController方法代码示例

本文整理汇总了C#中GameEntity.AppendController方法的典型用法代码示例。如果您正苦于以下问题:C# GameEntity.AppendController方法的具体用法?C# GameEntity.AppendController怎么用?C# GameEntity.AppendController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameEntity的用法示例。


在下文中一共展示了GameEntity.AppendController方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Control

 public override bool Control( GameEntity control, TimeSpan gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyState )
 {
     if ( control is Projectile )
     {
         HashSet<Tank> tanks = new HashSet<Tank>();
         if ( control.Variables.ContainsKey( "Hypnotize" ) )
         {
             tanks = ( ( HashSet<Tank> )control.Variables[ "Hypnotize" ] );
         }
         if ( Vector2.Distance( control.Position, Owner.Position ) < rad )// && !Tools.IsGoingTowardsMe( Owner.Position, control.Angle, control.Position ) )
         {
             if ( !control.Variables.ContainsKey( "Hypnotize" ) || !tanks.Contains( Owner ) )
             {
                 DeflectorController d = new DeflectorController( Tools.Angle( Owner.Position, control.Position ) );
                 control.AppendController( d );
                 tanks.Add( Owner );
             }
         }
         else
         {
             tanks.Remove( Owner );
         }
         control.Variables[ "Hypnotize" ] = tanks;
     }
     return base.Control( control, gameTime, keyState );
 }
开发者ID:nitzanbueno,项目名称:TanksDropTwo,代码行数:26,代码来源:Hypnotizer.cs

示例2: InstantControl

 public override void InstantControl( GameEntity control, TimeSpan gameTime )
 {
     float closestDistance = -1; // The distance to the closest tank
     Tank closestTank = null; // The closest tank
     // Find the closest living tank
     foreach ( Tank t in Tanks )
     {
         float dist = Vector2.DistanceSquared( Owner.Position, t.Position );
         if ( t.IsAlive )
         {
             if ( ( closestTank == null || dist < closestDistance ) )
             {
                 closestDistance = dist;
                 closestTank = t;
             }
         }
     }
     if ( closestTank != null ) // If no tank is alive don't do anything
     {
         // Set owner's angle
         float ang = Tools.Angle( control.Position, closestTank.Position );
         DeflectorController c = new DeflectorController( ang );
         control.AppendController( c );
     }
 }
开发者ID:nitzanbueno,项目名称:TanksDropTwo,代码行数:25,代码来源:Aimbot.cs


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