/// <summary> /// Called when the tank hits a fence. /// Returns false if the tank should stop and true if it should keep going. /// </summary> /// <param name="hitter">The hit fence.</param> /// <returns>False if the tank should stop - otherwise true.</returns> public virtual bool HitFence( Fence hitter ) { return false; }
/// <summary> /// Places a new fence on the board. /// </summary> /// <param name="gameTime">The current game time.</param> private void PlaceFence( TimeSpan gameTime ) { float dist = Vector2.Distance( Vector2.Zero, Origin ); float sideDeg = 40F; Fence newFence = new Fence( Position + ( new Vector2( (float)Math.Cos( MathHelper.ToRadians( Angle + sideDeg ) ), (float)Math.Sin( MathHelper.ToRadians( Angle + sideDeg ) ) ) * dist * Scale * 1.5F ), Position + ( new Vector2( (float)Math.Cos( MathHelper.ToRadians( Angle - sideDeg ) ), (float)Math.Sin( MathHelper.ToRadians( Angle - sideDeg ) ) ) * dist * Scale * 1.5F ), this, 16, gameTime, FenceLifeTime ); newFence.Initialize( Game ); NumberOfFences++; Game.QueueEntity( newFence ); placeSound.Play(); }