コード例 #1
0
ファイル: Ring.cs プロジェクト: nitzanbueno/TanksDropTwo
 public override bool Control( GameEntity control, TimeSpan gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyState )
 {
     // Move angle
     angle += 5F;
     if ( angle >= 370 + orig_angle )
     {
         Owner.RemoveTankController();
     }
     else
     {
         // Put fence
         float dist = Vector2.Distance( Vector2.Zero, Owner.Origin );
         float sideDeg = 40F;
         Vector2 Pos = Position + ( new Vector2( ( float )Math.Cos( MathHelper.ToRadians( angle ) ), ( float )Math.Sin( MathHelper.ToRadians( angle ) ) ) * rad );
         Fence newFence = new Fence(
             Pos + ( new Vector2( ( float )Math.Cos( MathHelper.ToRadians( angle + sideDeg ) ), ( float )Math.Sin( MathHelper.ToRadians( angle + sideDeg ) ) ) * dist * Scale * 1.5F ),
             Pos + ( new Vector2( ( float )Math.Cos( MathHelper.ToRadians( angle - sideDeg ) ), ( float )Math.Sin( MathHelper.ToRadians( angle - sideDeg ) ) ) * dist * Scale * 1.5F ), Owner, 16, gameTime, Owner.FenceLifeTime );
         newFence.Initialize( Game );
         Game.QueueEntity( newFence );
     }
     return base.Control( control, gameTime, keyState );
 }