예제 #1
0
 /// <summary>
 /// Adds rock to Klaus' inventory
 /// </summary>
 /// <param name="myPlayer">The player whose inventory we add to</param>
 public void AddItem(Klaus myPlayer)
 {
     if (ItemActive())
     {
         myPlayer.Inventory.Add(this.itemName, this);
     }
 }
예제 #2
0
        public void Climb(Klaus myPlayer)
        {
            MouseState mouse = Mouse.GetState();

            if (this.isActive && mouse.LeftButton == ButtonState.Pressed)
            {
                // Klaus climbs up ladder
                // maybe a myPlayer.Climb() kind of thing
            }
        }
예제 #3
0
파일: Chest.cs 프로젝트: HanulM/Telekat
        //Opens the chest and gives the player and item
        public void OpenChest(Klaus myPlayer)
        {
            MouseState mouse = Mouse.GetState();

            //Checks if the player decided to open the chest. 
            //Only opens if the chest is active.
            if(this.ItemActive() == true && mouse.LeftButton == ButtonState.Pressed && itemBox.Contains(mouse.X, mouse.Y))
            {
                //Add item to the inventory of Klaus (dictionary) 
                myPlayer.Inventory.Add(itemName, chestItem);
            }
        }
예제 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch      = new SpriteBatch(GraphicsDevice);
            titleScreen      = Content.Load <Texture2D>("title-screen");
            klausSprite      = Content.Load <Texture2D>("klause_sprite");
            level1           = Content.Load <Texture2D>("level-1");
            font             = Content.Load <SpriteFont>("Font");
            pauseButton      = Content.Load <Texture2D>("PauseButton");
            pauseMenu        = Content.Load <Texture2D>("pause-menu");
            pauseMenuButtons = Content.Load <Texture2D>("PauseMenu");

            klaus = new Klaus(klausSprite, playerBox, spriteBatch, new Vector2(250f, 435f));
            // TODO: use this.Content to load your game content here
        }