public PatternStars(Pattern pattern, GameplayScreen game, double timeToAppear)
 {
     stars = new List<Star>();
     this.game = game;
     this.pattern = pattern;
     this.timeAppeared = 0.0;
     this.timeToAppear = timeToAppear;
     this.mAlphaValue = 255;
     this.alphaValueIncrementPerSecond = (int)((2 * 255) / this.timeToAppear);
     InitiatePattern();
 }
Example #2
0
 public Star(Texture2D starTexture, Vector2 vecPosition, GameplayScreen game)
 {
     this.starTexture = starTexture;
     this.vecPosition = vecPosition;
     this.vecDimensions = new Vector2(50, 50);
     this.game = game;
     this.fIsDrawing = true;
     this.timeToAppear = 5.0;
     this.timeAppeared = 0.0;
     this.hasAchieved = false;
     CalculateScale();
 }
 public BonusObject(Texture2D texture2D, GameplayScreen game, Vector2 dimensions, double timeToAppear)
 {
     this.texture2d = texture2D;
     this.game = game;
     this.dimensions = dimensions;
     //CalculateScale();
     this.noOfTimesDrawn = 0;
     this.noOfTimesAchieved = 0;
     this.lastAchievedScore = -1;
     this.lastDrawnScore = -1;
     this.lastDrawnTime = -1;
     this.timeToAppear = timeToAppear;
 }
 public static void RenderPatternStars(SpriteBatch spriteBatch, GameTime gameTime,
     GameplayScreen game)
 {
     if (currentPatternStars == null && gameTime.TotalGameTime.TotalSeconds > game.stats.gameStartTime + 1.0)
     {
         //lastShownGameTime = gameTime.TotalGameTime.TotalSeconds;
         currentPatternStars = new PatternStars(IntToPattern(currentPatternInteger),
             game, 5.0);
         currentPatternInteger = (currentPatternInteger + 1) % (int)(Pattern.lastPattern);
     }
     if (currentPatternStars != null)
     {
         currentPatternStars.draw(spriteBatch);
     }
 }
 public Football(GameplayScreen game, Vector2 startPosition, Vector2 startSpeed, float radius, Stats stats)
 {
     this.game = game;
     position = startPosition;
     speed = startSpeed;
     acceleration = gravityAcceleration;
     this.radius = radius;
     this.stats = stats;
     maxDistance = 2.4f * radius;
     this.bonusObjectsInEffect = new List<BonusObject>();
     this.isBallSmallerChange = false;
     this.timeBallSmallerChange = 0.0;
     this.isWindInEffect = false;
     this.timeWindInEffect = 0.0;
     //CalculateScale();
     this.inTouchWithWall = true;
 }
        public static void RenderBonusObjects(GameplayScreen game, SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (currentDrawnBonusObjects.Count() == 0)
            {
                List<BonusObject> totalBonusObjects = game.bonusObjects;

                // go through the list of bonus objects and form a list
                // of objects you can actually render
                List<BonusObject> canRenderBonusObjects = new List<BonusObject>();
                foreach (BonusObject bo in totalBonusObjects)
                {
                    if (bo.CanDraw())
                    {
                        canRenderBonusObjects.Add(bo);
                    }
                }

                // go through the list of canRender objects and choose something
                // to draw
                if (canRenderBonusObjects.Count > 0)
                {
                    // start drawing the bonus object
                    BonusObject toDrawBonusObject = canRenderBonusObjects.ElementAt(0);
                    Vector2 positionToDrawbo = toDrawBonusObject.GetPositionToDraw();
                    toDrawBonusObject.StartDrawing(positionToDrawbo, gameTime);
                    if (!currentDrawnBonusObjects.Contains(toDrawBonusObject))
                    {
                        currentDrawnBonusObjects.Add(toDrawBonusObject);
                        countOfBonusObject++;
                    }
                }
            }

            foreach (BonusObject bo in currentDrawnBonusObjects)
            {
                bo.Draw(spriteBatch);
            }
        }
 public RingBonusObject(GameplayScreen game, Vector2 scale, double timeToAppear)
     : base(ringTexture, game, scale, timeToAppear)
 {
 }
        public static void UpdateBonusObjects(GameplayScreen game, GameTime gameTime)
        {
            // go throught the list of currrent drawn objects,
            // and check to see if they are achieved.
            // if they are, then cancel drawing on them, and apply the change
            // if they are not, then just update them
            List<BonusObject> bonusObjectsToCancelDrawing = new List<BonusObject>();
            foreach (BonusObject bo in currentDrawnBonusObjects)
            {
                if (bo.isAchieving(game.football))
                {
                    bo.makeChange(game.football, gameTime);
                    bonusObjectsToCancelDrawing.Add(bo);
                    bo.CancelDrawing();
                }
                else if (!bo.Update(gameTime))
                {
                    // if it returns false, we need to cancel drawing too
                    bonusObjectsToCancelDrawing.Add(bo);
                    bo.CancelDrawing();
                }
            }

            foreach (BonusObject bo in bonusObjectsToCancelDrawing)
            {
                if (currentDrawnBonusObjects.Contains(bo))
                {
                    currentDrawnBonusObjects.Remove(bo);
                }
            }
        }
 public static void ResetAllBonusObjects(GameplayScreen game)
 {
     foreach (BonusObject bo in game.bonusObjects)
     {
         bo.ResetStats();
     }
 }
 public WindBonusObject(GameplayScreen game, Vector2 scale, double timeToAppear)
     : base(windTexture, game, scale, timeToAppear)
 {
 }
 public SmallBallBonusObject(GameplayScreen game, Vector2 scale, double timeToAppear)
     : base(Football.ballTexture, game, scale, timeToAppear)
 {
 }