Fire() public method

public Fire ( ) : void
return void
Example #1
0
 /// <summary>
 /// Fire a shot from a player.
 /// </summary>
 /// <param name="index">Index of the player who took the shot</param>
 public void FirePlayer(int index)
 {
     Player p = this.players[index];
     if (p.PlayerActive)
     {
         // Resize all sights.
         float size = (float)this.ActualWidth * 0.05f;
         float sightsWidth = size * 0.1f;
         float sightsClose = size * 0.5f;
         float sightsInnerWidth = size * 0.2f;
         SightsControl s = new SightsControl
         {
             SightsColor = p.Sights.SightsColor,
             Width = size,
             Height = size,
             SightsWidth = 0.0f,
             SightsClose = sightsClose,
             SightsInnerWidth = 0.0f
         };
         MainCanvas.Children.Add(s);
         Canvas.SetLeft(s, p.X - size / 2.0f);
         Canvas.SetTop(s, p.Y - size / 2.0f);
         float x = p.X / (float)this.ActualWidth;
         float y = p.Y / (float)this.ActualHeight;
         s.FireAnimationStoryBoard.Completed += (snd, arg) => ShotEnded(p, x, y, s);
         s.Fire();
     }
 }