コード例 #1
0
ファイル: Level.cs プロジェクト: klegan711/Gravity-Shift
 public void Dispose()
 {
     this.mActiveAnimations.Clear();
     this.backgroundParticles = null;
     int temp = this.mObjects.Capacity;
     this.mObjects.Clear();
     this.mObjects.TrimExcess();
     this.mCollisionMatrix = null;
     this.mTrigger.Clear();
     this.mTrigger.TrimExcess();
     this.collectibleEngine = null;
     this.wallEngine = null;
     this.mContent = null;
     if (this.mCollectableLocations != null)
     {
         this.mCollectableLocations.Clear();
         this.mCollectableLocations.TrimExcess();
     }
     System.GC.Collect();
 }
コード例 #2
0
ファイル: Level.cs プロジェクト: billyboy429/Gravity-Shift
        /// <summary>
        /// Loads the level from the content manager
        /// </summary>
        /// <param name="content">Content Manager to load from</param>
        public void Load(ContentManager content, string assetName)
        {
            mKootenay = content.Load<SpriteFont>("fonts/Kootenay");
            mQuartz = content.Load<SpriteFont>("fonts/QuartzLarge");

            //            mDirections = new Texture2D[4];
            //            mDirections[3] = content.Load<Texture2D>("HUD/arrow_left");
            //            mDirections[2] = content.Load<Texture2D>("HUD/arrow_down");
            //            mDirections[1] = content.Load<Texture2D>("HUD/arrow_right");
            //            mDirections[0] = content.Load<Texture2D>("HUD/arrow_up");

            mRailLeft = content.Load<Texture2D>("Images/NonHazards/Rails/RailLeft");
            mRailHor = content.Load<Texture2D>("Images/NonHazards/Rails/RailHorizontal");
            mRailRight = content.Load<Texture2D>("Images/NonHazards/Rails/RailRight");
            mRailTop = content.Load<Texture2D>("Images/NonHazards/Rails/RailTop");
            mRailBottom = content.Load<Texture2D>("Images/NonHazards/Rails/RailBottom");
            mRailVert = content.Load<Texture2D>("Images/NonHazards/Rails/RailVertical");

            mContent = content;

            mNumCollected = 0;
            mNumCollectable = 0;

            // Particle Engine
            List<Texture2D> textures = new List<Texture2D>();
            textures.Add(content.Load<Texture2D>("Images/Particles/diamond"));
            textures.Add(content.Load<Texture2D>("Images/Particles/star"));
            collectibleEngine = new ParticleEngine(textures, new Vector2(400, 240), 20);
            collectibleEngine.colorScheme = "Yellow";

            textures = new List<Texture2D>();
            textures.Add(content.Load<Texture2D>("Images/Particles/line"));
            textures.Add(content.Load<Texture2D>("Images/Particles/square"));
            wallEngine = new ParticleEngine(textures, new Vector2(400, 240), 20);
            wallEngine.colorScheme = "Blue";

            backGroundParticleCount = 500;
            backgroundParticles = new Particle[backGroundParticleCount];
            Random random = new Random();
            for (int i = 0; i < backGroundParticleCount; i++)
            {
                Vector2 pos = new Vector2(random.Next(-mScreenRect.Width / 2,3 * mScreenRect.Width / 2),
                    random.Next(-mScreenRect.Height / 2,3* mScreenRect.Height / 2));
                backgroundParticles[i] = new Particle(content.Load<Texture2D>("Images/Particles/diamond"), pos, random);
            }

            //lastCollided = new GameObject[2];
            //lastCollided[0] = lastCollided[1] = null;
            lastCollided = null;

            mCollectableLocations = new List<Vector2>();
        }
コード例 #3
0
ファイル: Level.cs プロジェクト: billyboy429/Gravity-Shift
        /// <summary>
        /// Loads the level from the content manager
        /// </summary>
        /// <param name="content">Content Manager to load from</param>
        public void Load(ContentManager content, string assetName)
        {
            mKootenay = content.Load<SpriteFont>("fonts/Kootenay");
            mQuartz = content.Load<SpriteFont>("fonts/QuartzLarge");

            //            mDirections = new Texture2D[4];
            //            mDirections[3] = content.Load<Texture2D>("HUD/arrow_left");
            //            mDirections[2] = content.Load<Texture2D>("HUD/arrow_down");
            //            mDirections[1] = content.Load<Texture2D>("HUD/arrow_right");
            //            mDirections[0] = content.Load<Texture2D>("HUD/arrow_up");

            mRailLeft = content.Load<Texture2D>("Images/NonHazards/Rails/RailLeft");
            mRailHor = content.Load<Texture2D>("Images/NonHazards/Rails/RailHorizontal");
            mRailRight = content.Load<Texture2D>("Images/NonHazards/Rails/RailRight");
            mRailTop = content.Load<Texture2D>("Images/NonHazards/Rails/RailTop");
            mRailBottom = content.Load<Texture2D>("Images/NonHazards/Rails/RailBottom");
            mRailVert = content.Load<Texture2D>("Images/NonHazards/Rails/RailVertical");

            mContent = content;

            mNumCollected = 0;
            mNumCollectable = 0;

            // Particle Engine
            List<Texture2D> textures = new List<Texture2D>();
            textures.Add(content.Load<Texture2D>("Images/Particles/diamond"));
            textures.Add(content.Load<Texture2D>("Images/Particles/star"));
            collectibleEngine = new ParticleEngine(textures, new Vector2(400, 240), 20);
            collectibleEngine.colorScheme = "Yellow";

            textures = new List<Texture2D>();
            textures.Add(content.Load<Texture2D>("Images/Particles/line"));
            textures.Add(content.Load<Texture2D>("Images/Particles/square"));
            wallEngine = new ParticleEngine(textures, new Vector2(400, 240), 20);
            wallEngine.colorScheme = "Blue";

            //lastCollided = new GameObject[2];
            //lastCollided[0] = lastCollided[1] = null;
            lastCollided = null;

            mCollectableLocations = new List<Vector2>();
        }