Example #1
0
        /// <summary>
        /// Detection if bullet colides with field
        /// </summary>
        /// <param name="bulletX"></param>
        /// <param name="bulletY"></param>
        /// <returns></returns>
        public bool IsFieldTouched(BG_Location bulletLocation)
        {
            bool isHit = false;

            foreach (BG_Location fieldLocation in this.Locations)
            {
                if (bulletLocation.PosX == fieldLocation.PosX && bulletLocation.PosY >= fieldLocation.PosY)
                {
                    isHit = true;
                }
            }
            return(isHit);
        }
Example #2
0
        /// <summary>
        /// Designated constructor
        /// </summary>
        /// <param name="rotation">Angle setter</param>
        /// <param name="bColor">Color of body canon</param>
        /// <param name="location">Location of the canon</param>
        public BG_Cannon(float rotation, Color bColor, BG_Location location)
        {
            this.Rotation = rotation;
            this.Location = location;

            this.BobyBrush          = new SolidBrush(bColor);
            this.defaultCannonBrush = new SolidBrush(Color.Black);
            this.defaultBulletBrush = new SolidBrush(Color.Gray);

            this.BodySize   = new Size(DEFAULT_BODY_SIZE_X, DEFAULT_BODY_SIZE_Y);
            this.CannonSize = new Size(DEFAULT_CANNON_SIZE_X, DEFAULT_CANNON_SIZE_Y);

            this.RecBody          = new Rectangle(Location.PosX, Location.PosY, this.BodySize.Width, this.BodySize.Height);
            this.RecCannon        = new Rectangle(new Point(0, 0), this.CannonSize);
            this.PermissionToFire = false;
        }
Example #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="bColor">Color of body canon</param>
 /// <param name="location">Location of the canon</param>
 public BG_Cannon(Color bColor, BG_Location location)
     : this(DEFAULT_ROTATION, bColor, location)
 {
     //no code
 }
Example #4
0
 /// <summary>
 /// Move the canon to another position
 /// </summary>
 /// <param name="location">New Position</param>
 public void Move(BG_Location location)
 {
     this.Location = location;
 }
Example #5
0
 // Designated constructor
 public BG_Hit(BG_Location location, BG_Cannon cannon)
 {
     this.Location = location;
     this.Cannon   = cannon;
 }
Example #6
0
 public void MoveCannon(BG_Location location)
 {
     this.Cannon.Move(location);
 }