示例#1
0
        // Place the house in a random position.
        private void PositionHouse()
        {
            // See how big to make the house on the screen.
            int   houseWidth  = 50;
            float scale       = (float)houseWidth / Properties.Resources.house.Width;
            int   houseHeight = (int)(Properties.Resources.house.Height * scale);

            Random rand     = new Random();
            int    sceneWid = scenePictureBox.ClientSize.Width;
            float  x        = rand.Next((int)(BaseX + MaxR), sceneWid - houseWidth);
            float  y        = GroundRect.Top - 0.85f * houseHeight;

            HouseRect = new RectangleF(x, y, houseWidth, houseHeight);

            // Make a smaller target rectangle.
            TargetRect = HouseRect;
            TargetRect.Inflate(-houseWidth * 0.2f, -houseHeight * 0.1f);
        }
示例#2
0
 void Awake()
 {
     Instance = this;
 }