Ejemplo n.º 1
0
        private void GenerateRandomCloud(ContentManager myContent, GraphicsDeviceManager myGraphics, GameTime aGameTime)
        {
            float tempRandomSpeed = RandomNumber.Between(3, 8) / 10.0f;

            myLatestAddedCloud = aGameTime.TotalGameTime.Seconds;
            CloudElement aCloudElement = new CloudElement(0.6f, -1.0f, 0.0f, tempRandomSpeed, new Vector2(myGraphics.PreferredBackBufferWidth, RandomNumber.Between(1, 50)), myGraphics);

            aCloudElement.LoadContent(myContent, new string[] { "Elements/cloud1", "Elements/cloud2", "Elements/cloud3", "Elements/cloud4", "Elements/ShittySeagull" });
            myClouds.Add(aCloudElement);
            foreach (CloudElement cloud in myClouds.Where(s => s.AccessOutOfBounds).ToList())
            {
                myClouds.Remove(cloud);
            }
        }
Ejemplo n.º 2
0
        private void GenerateInitialClouds(ContentManager myContent)
        {
            float tempRandomSpeed = RandomNumber.Between(3, 8) / 10.0f;

            //Generate five random clouds initially and place them on the screen from start
            foreach (int cloudPosition in new int[]
            {
                RandomNumber.Between(0, myGraphics.PreferredBackBufferWidth / 5 * 1),
                RandomNumber.Between(myGraphics.PreferredBackBufferWidth / 5 * 1, myGraphics.PreferredBackBufferWidth / 5 * 2),
                RandomNumber.Between(myGraphics.PreferredBackBufferWidth / 5 * 2, myGraphics.PreferredBackBufferWidth / 5 * 3),
                RandomNumber.Between(myGraphics.PreferredBackBufferWidth / 5 * 3, myGraphics.PreferredBackBufferWidth / 5 * 4),
                RandomNumber.Between(myGraphics.PreferredBackBufferWidth / 5 * 4, myGraphics.PreferredBackBufferWidth / 5 * 5)
            })
            {
                CloudElement aCloudElement = new CloudElement(0.6f, -1.0f, 0.0f, tempRandomSpeed, new Vector2(cloudPosition, RandomNumber.Between(1, 50)), myGraphics);
                aCloudElement.LoadContent(myContent, new string[] { "Elements/cloud1", "Elements/cloud2", "Elements/cloud3", "Elements/cloud4", "Elements/ShittySeagull" });
                myClouds.Add(aCloudElement);
            }
        }