示例#1
0
        public void LoadContent(ContentManager theContentManager)
        {
            mContentManager = theContentManager;
            base.LoadContent(theContentManager, ASSETNAME);
            Source = new Rectangle(66, 65, 73, 135);

            mGunhand = new Gunarm();
            mGunhand.LoadContent(this.mContentManager);

            mOrbs[0] = new PortalGunBullet();
            mOrbs[0].LoadContent(this.mContentManager, 0);
            mOrbs[1] = new PortalGunBullet();
            mOrbs[1].LoadContent(this.mContentManager, 1);

            mJumpEffect = theContentManager.Load<SoundEffect>("Sounds\\PlayerJump");
            mDeathEffect = theContentManager.Load<SoundEffect>("Sounds\\PlayerKilled");
            mLandingEffect = theContentManager.Load<SoundEffect>("Sounds\\PlayerLanding");

            Center = new Vector2(Size.Width / 2, Size.Height / 2);
        }
示例#2
0
        public void LoadContent(ContentManager theContentManager)
        {
            mContentManager = theContentManager;
            base.LoadContent(theContentManager, ASSETNAME);

            mGunhand = new Gunarm();
            mGunhand.LoadContent(this.mContentManager);

            mOrbs[0] = new PortalGunBullet();
            mOrbs[0].LoadContent(this.mContentManager, 0);
            mOrbs[1] = new PortalGunBullet();
            mOrbs[1].LoadContent(this.mContentManager, 1);

            //Load animations -- must include frame count for constant frameTime constructor
            float[] jumpTiming = { 0.1f, 0.1f, 0.1f, 0.2f, 0.1f };
            idleAnimation = new Animation(theContentManager.Load<Texture2D>("Sprites\\Player\\Idle"), 0.1f, 1, true);
            runAnimation = new Animation(theContentManager.Load<Texture2D>("Sprites\\Player\\Run"), 0.05f, 5, true);
            jumpAnimation = new Animation(theContentManager.Load<Texture2D>("Sprites\\Player\\Jump"), jumpTiming, false);
            victoryAnimation = new Animation(theContentManager.Load<Texture2D>("Sprites\\Player\\Victory"), 0.15f, 5, false);
            deathAnimation = new Animation(theContentManager.Load<Texture2D>("Sprites\\Player\\Death"), 0.15f, 5, false);

            int width = (int)(idleAnimation.FrameWidth);// * 0.9f);
            int left = 0;// (idleAnimation.FrameWidth - width) / 2;
            int height = (int)(idleAnimation.FrameHeight);//* 0.8f);
            int top = idleAnimation.FrameHeight - height;
            Source = new Rectangle(left, top, width, height);

            animator.PlayAnimation(idleAnimation);

            mJumpEffect = theContentManager.Load<SoundEffect>("Sounds\\PlayerJump");
            mDeathEffect = theContentManager.Load<SoundEffect>("Sounds\\PlayerKilled");
            mLandingEffect = theContentManager.Load<SoundEffect>("Sounds\\PlayerLanding");
            antiportalEffect = theContentManager.Load<SoundEffect>("Sounds\\antiportal");

            Center = new Vector2(Size.Width / 2, Size.Height / 2);
        }