public void Update(GameTime gameTime) { #region change button color logic row1x1 if (leapRectangle.Intersects(boxCollisionRect[0])) { leapBoxHit = LeapBoxHit.row1x1; if (isTimeSet == false) { isTimeSet = true; baseSeconds = gameTime.TotalGameTime.Seconds; } if (universalButtonHit[0] == false) { if ((gameTime.TotalGameTime.Seconds) == (baseSeconds + 1)) { universalButtonHit[0] = true; } } } else { isTimeSet = false; // leapBoxHit = LeapBoxHit.none; } #endregion }
public LeapTimeButton() { universalLeapButtonRect = new Rectangle(0, 0, 256, 256); universalLeapButtonColor = Color.White; leapRectangle = new Rectangle(800, 0, 64, 64); changingTime = new GameTime(); boxLocations = new Vector2[3, 3]; leapBoxHit = LeapBoxHit.none; boxLocations[0, 0] = new Vector2(150, 100); boxLocations[0, 1] = new Vector2(370, 90); boxLocations[0, 2] = new Vector2(570, 95); boxLocations[1, 0] = new Vector2(140, 290); boxLocations[1, 1] = new Vector2(365, 300); boxLocations[1, 2] = new Vector2(575, 290); boxLocations[2, 0] = new Vector2(155, 520); boxLocations[2, 1] = new Vector2(365, 510); boxLocations[2, 2] = new Vector2(570, 520); universalButtonHit = new bool[9]; universalButtonHit[0] = false; universalButtonHit[1] = false; universalButtonHit[2] = false; universalButtonHit[3] = false; universalButtonHit[4] = false; universalButtonHit[5] = false; universalButtonHit[6] = false; universalButtonHit[7] = false; universalButtonHit[8] = false; boxCollisionRect = new Rectangle[9]; boxCollisionRect[0] = new Rectangle((int)boxLocations[0, 0].X, (int)boxLocations[0, 0].Y, 130, 130); boxCollisionRect[1] = new Rectangle((int)boxLocations[0, 1].X, (int)boxLocations[0, 1].Y, 130, 130); boxCollisionRect[2] = new Rectangle((int)boxLocations[0, 2].X, (int)boxLocations[0, 2].Y, 130, 130); boxCollisionRect[3] = new Rectangle((int)boxLocations[1, 0].X, (int)boxLocations[1, 0].Y, 130, 130); boxCollisionRect[4] = new Rectangle((int)boxLocations[1, 1].X, (int)boxLocations[1, 1].Y, 130, 130); boxCollisionRect[5] = new Rectangle((int)boxLocations[1, 2].X, (int)boxLocations[1, 2].Y, 130, 130); boxCollisionRect[6] = new Rectangle((int)boxLocations[2, 0].X, (int)boxLocations[2, 0].Y, 130, 130); boxCollisionRect[7] = new Rectangle((int)boxLocations[2, 1].X, (int)boxLocations[2, 1].Y, 130, 130); boxCollisionRect[8] = new Rectangle((int)boxLocations[2, 2].X, (int)boxLocations[2, 2].Y, 130, 130); }