Exemple #1
0
        public void Update(Hero theHero)
        {
            mFishFood.Update(theHero, mTheFloorSet, mTheSeaweedTallSet);
            mEnemies.UpdateSet(theHero);

            if (Camera.CameraWindowLowerRightPosition.X > mTheFloorSet[mTheFloorSet.Count - 1].Position.X)
            {
                for (int i = 0; i < mTheFloorSet.Count; i++)
                {
                    mTheFloorSet[i].PositionX += kFloorAndRoofSize * 10;
                }

                float randNum;
                for (int i = 0; i < mTheSeaweedTallSet.Count; i++)
                {
                    if (mTheSeaweedTallSet[i].PositionX < Camera.CameraWindowLowerLeftPosition.X - mTheSeaweedTallSet[i].Width)
                    {
                        randNum = (float)Game1.sRan.NextDouble() * kSectionSize / 2 + Camera.CameraWindowLowerRightPosition.X;
                        mTheSeaweedTallSet[i].PositionX = randNum;
                    }
                }

                for (int i = 0; i < mTheSeaweedSmallSet.Count; i++)
                {
                    if (mTheSeaweedSmallSet[i].PositionX < Camera.CameraWindowLowerLeftPosition.X - mTheSeaweedTallSet[i].Width)
                    {
                        randNum = (float)Game1.sRan.NextDouble() * kSectionSize / 2 + Camera.CameraWindowLowerRightPosition.X;
                        mTheSeaweedSmallSet[i].PositionX = randNum;
                    }
                }
            }

            if ((Camera.CameraWindowLowerLeftPosition.X - mTheSign.Width) > mTheSign.PositionX)
            {
                if (mTheSign.PositionX == kInitialSignPosX)
                {
                    mTheSign.PositionX = 0;
                }
                mTheSign.PositionX += 500;
            }
        }
Exemple #2
0
 /// <summary>
 /// Allows the game to run logic such as updating the world,
 /// checking for collisions, gathering input, and playing audio.
 /// </summary>
 public void UpdateGame()
 {
     mHero.UpdateHero();
     mNumCaught += mEnemies.UpdateSet(mHero);
 }