Пример #1
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager contentManager)
        {
            //Sets up 3D sound
            soundEffects = new SoundEffectPlayer(this);
            soundEffects.LoadSound("LaserShoot", contentManager.Load<SoundEffect>("Sounds/LaserShoot"));

            base.LoadContent(contentManager);
        }
Пример #2
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager contentManager)
        {
            base.LoadContent(contentManager);
            soundEffects = new SoundEffectPlayer(this);
            soundEffects.LoadSound("Button", GameplayScreen._sounds["Button"]);
            animmodel.LoadContent(contentManager);

            // Provides a hitbox for the block - Steven
            UpdateBoundingBox(animmodel.Model, Matrix.CreateTranslation(animmodel.Position), true, false);
        }
Пример #3
0
        public LaserProjectile(int column, int row, GameConstants.POINTDIR direction)
            : base(column, row)
        {
            base.Model = GameplayScreen._models["projectile"];
            Scale(1.9f, 3f, 3f);
            //Rotate(0f, 0f, 90f);
            //SetVerticalOffset();
            //SetHorizontalOffset(30);
            active = true;
            this.direction = direction;
            isCollidable = false ;

            SetDirection();

            // hitbox for collision
            UpdateBoundingBox(base.Model, Matrix.CreateTranslation(base.Position), false, false);

            soundEffects = new SoundEffectPlayer(this); //set up sound
            soundEffects.LoadSound("LaserWhirLoop", GameplayScreen._sounds["LaserWhirLoop"]);
            soundEffects.PlayAndLoopSound("LaserWhirLoop");
        }
Пример #4
0
        public override void LoadContent(ContentManager contentManager)
        {
            animmodel.LoadContent(contentManager);
            // Provides a hitbox for the block - Steven
            UpdateBoundingBox(animmodel.Model, Matrix.CreateTranslation(base.Position), false, false);
            base.HitboxWidth = 40;
            base.HitboxHeight = 16;
            base.HitboxHeightOffset = 20;
            soundEffects = new SoundEffectPlayer(this);
            SoundEffect sound = contentManager.Load<SoundEffect>("Sounds/DoombaLoop");
            soundEffects.LoadSound("Roomba", contentManager.Load<SoundEffect>("Sounds/DoombaLoop"));
            soundEffects.PlayAndLoopSound("Roomba");
            soundEffects.SoundInstances["Roomba"].Volume = 1f;
            base.LoadContent(contentManager);

            //attack range
            enemyRangeL = new Rectangle((int)(Position.X - (HitboxWidth * 10)), (int)(Position.Y + (HitboxHeight * 1.5)), (HitboxWidth * 10), (HitboxHeight));
            enemyRangeR = new Rectangle((int)(Position.X + (HitboxWidth)), (int)(Position.Y + (HitboxHeight * 1.5)), (HitboxWidth * 10), (HitboxHeight));

            // generate random direction and initialize
            Random rand = new Random();
            if (rand.Next(0, 1) == 0)
                direction = GameConstants.POINTDIR.pointLeft;
            else
                direction = GameConstants.POINTDIR.pointRight;
        }
Пример #5
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager contentManager)
        {
            base.LoadContent(contentManager);
            charModel.LoadContent(contentManager);
            charModel.SetAnimationSpeed(1.0f);
            charModel.PlayAnimation("Idle", true, 0f);
            UpdateBoundingBox(charModel.Model, Matrix.CreateTranslation(charModel.Position), true, true);
            // Overriding the hitbox size, the new model will need to be the height of the cells, for now the vamp model height is overrided - Steven
            base.HitboxWidth = 24;
            HitboxWidthOffset = 12;
            base.HitboxHeight = 48;

            //Load sound effects
            //soundFX = new Dictionary<string, SoundEffect>();
            soundEffects = new SoundEffectPlayer(this);
            soundEffects.LoadSound("BoxDrop", GameplayScreen._sounds["BoxDrop"]);
            soundEffects.LoadSound("BoxPickup", GameplayScreen._sounds["BoxPickup"]);
            soundEffects.LoadSound("Jump", GameplayScreen._sounds["Jump"]);
            soundEffects.LoadSound("Land", GameplayScreen._sounds["Land"]);
            soundEffects.LoadSound("PlayerHit", GameplayScreen._sounds["PlayerHit"]);
            soundEffects.LoadSound("ToggleSwitch", GameplayScreen._sounds["ToggleSwitch"]);
        }
Пример #6
0
        /// <summary>
        /// Update code for the MessageEvent. Handles typing internally; it's just a matter of incrementing the state in order to start it.
        /// </summary>
        /// <param name="renderContext"></param>
        public override void Update(RenderContext renderContext)
        {
            if (this.typingState == GameConstants.TYPING_STATE.Disabled || this.typingState == GameConstants.TYPING_STATE.NotTyped) //Completely cease update upon being disabled.
            {
                return;
            }

            //Action button leads to closing the screen, if typing is all displayed.
            if (this.typingState == GameConstants.TYPING_STATE.DoneTyping
                && ((Keyboard.GetState().IsKeyDown(Keys.F) && lastKey.IsKeyUp(Keys.F)) ||
                    (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.B) && lastButton.IsButtonUp(Buttons.B))))
            {
                this.typingState = GameConstants.TYPING_STATE.Disabled;
                GameplayScreen.messageActive = false;
            }

            //Action button leads to finishing typing, if currently typing.
            else if(this.typingState == GameConstants.TYPING_STATE.Typing
                 && ((Keyboard.GetState().IsKeyDown(Keys.F) && lastKey.IsKeyUp(Keys.F)) ||
                    (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.B) && lastButton.IsButtonUp(Buttons.B))))
            {
                FinishTyping();
            }

            //When typing, have the typed text update, as if it were a typewriter.
            if (typingState == GameConstants.TYPING_STATE.Typing)
            {
                if (soundFX == null)
                {
                    soundFX = new SoundEffectPlayer(renderContext.Player);
                    soundFX.LoadSound("Type", renderContext.Sounds["Type"]);
                    soundFX.PlayAndLoopSound("Type");
                }
                //Update the typed text until it's done.
                if (elapsedTypingTime < totalTimeToType)
                {
                    elapsedTypingTime += renderContext.GameTime.ElapsedGameTime.Milliseconds;
                    typedMessage = Message.Substring(0, (int)(Message.Length * elapsedTypingTime / totalTimeToType)); //Get current message to be typed for the current point

                }
                else //done
                {
                    FinishTyping();
                }
            }
            else if (typingState == GameConstants.TYPING_STATE.DoneTyping) //Use the complete message.
            {
                typedMessage = Message;
            }
            typedMessageLines = GetLines(typedMessage, renderContext, renderContext.Textures["MessageBackground"].Width - 30); //Wrap text according to the width of the message box.

            //Update the previous button and key state.
            lastKey = Keyboard.GetState();
            lastButton = GamePad.GetState(PlayerIndex.One);

            base.Update(renderContext);
        }