/// <summary>
 /// Adds a new player to the game
 /// </summary>
 /// <param name="spriteSheet">Sprite sheet to use for the player</param>
 /// <param name="frameWidth">Width of an individual frame on the sprite sheet</param>
 /// <param name="frameHeight">Height of an individual frame on the sprite sheet</param>
 /// <param name="inventorySelected">Sprite to use for indicating the selected slot in the inverntory</param>
 /// <param name="inventoryUnselected">Sprite to use for indicating an unselected slot in the inverntory</param>
 public static void AddPlayer(Texture2D spriteSheet, int frameWidth, int frameHeight, Texture2D inventorySelected,
     Texture2D inventoryUnselected, Texture2D inventory, Vector2 screenSize)
 {
     ItemManager.inventories[numPlayers] = new Inventory(inventorySelected, inventoryUnselected, inventory, numPlayers, screenSize);
     players[numPlayers] = new Player(spriteSheet, frameWidth, frameHeight, new Vector2(0,0), numPlayers++);
 }
Example #2
0
 public void PlayerSighted(Player player)
 {
     enemy.enemyState = new ChaseState(enemy, player);
 }
Example #3
0
 public void PlayerSighted(Player player)
 {
     if (relaxTime <= 0)
     {
         enemy.enemyState = new ChaseState(enemy, player);
     }
 }
Example #4
0
 public void PlayerSighted(Player player)
 {
     // already chasing, do nothing
 }
Example #5
0
 public ChaseState(Enemy enemy, Player player)
 {
     this.enemy = enemy;
     enemy.chasing = player;
     enemy.velocity = new Vector2(0, 0);
 }
Example #6
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            Console.WriteLine("Choose what to test");
            Console.WriteLine("-------------------");
            Console.WriteLine("0. None");
            Console.WriteLine("1. Item branch");
            Console.WriteLine("2. Player branch");
            Console.WriteLine("3. Level branch");
            Console.WriteLine("4. Engine branch");
            Console.WriteLine("5. Enemy branch");
            Console.WriteLine("-------------------");
            //String choice = Console.ReadLine();
            String choice = "4";

            Vector2 screenSize = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            if (choice.Equals("1"))
            {
                Dictionary<String, Item> possibleItems = new Dictionary<String, Item>();
                itemManager = new ItemManagerTest(this, possibleItems);
            }
            else
            {
                Dictionary<String, Item> possibleItems = new Dictionary<String, Item>();
                possibleItems.Add("healthPotion", new Item("healthPotion", null, false, Content.Load<Texture2D>("healthpotion"), 32, 32, new Vector2(0, 0), screenSize));
                possibleItems.Add("drugPotion", new Item("drugPotion", null, false, Content.Load<Texture2D>("drugpotion"), 32, 32, new Vector2(0,0), screenSize));
                // add stuff here
                itemManager = new ItemManager(this, possibleItems);
            }

            if (choice.Equals("2"))
            {
                Console.WriteLine("Testing player");
                player = new PlayerTest(Content.Load<Texture2D>("player"), 32, 32, new Vector2(32,32), screenSize, this);
            }
            else
            {

                player = new Player(Content.Load<Texture2D>("player"), 32, 32, new Vector2(48, 48), screenSize, this);
            }

            if (choice.Equals("3"))
            {
                Dictionary<String, Block> possibleBlocks = new Dictionary<String, Block>();
                level = new LevelTest(this, possibleBlocks);

            }
            else
            {
                Dictionary<String, Block> possibleBlocks = new Dictionary<String, Block>();
                level = new Level(this, possibleBlocks);
            }

            if (choice.Equals("4"))
            {
                engine = new EngineTest(this);
            }
            else
            {
                engine = new Engine(this);
            }

            if (choice.Equals("5"))
            {
                //enemyManager = new TestEnemyManager(this);
            }
            else
            {
                //enemyManager = new EnemyManager(this);
            }

            base.Initialize();
        }