Ejemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="imagePath"></param>
 /// <param name="startPos"></param>
 /// <param name="scaleFactor"></param>
 /// <param name="enemyWeapon">Which weapon the enemy should use</param>
 public Enemy(string imagePath, Vector2D startPos, float scaleFactor, Weapon enemyWeapon)
     : base(imagePath, startPos, scaleFactor)
 {
     currentEnemyWeapon = enemyWeapon;
     GameWorld.objects.Add(currentEnemyWeapon);//Weapon should also be added to the list of objects
     Random hp = new Random();
     health = hp.Next(60, 101);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor for the player. Handles the weapon index as well.
        /// </summary>
        /// <param name="imagePath">sprite</param>
        /// <param name="startPos">Starting position</param>
        /// <param name="scaleFactor"></param>
        public Player(string imagePath, Vector2D startPos, float scaleFactor)
            : base(imagePath, startPos, scaleFactor)
        {
            velocity = new Vector2D(0, 0);
            health = 100;
            isAlive = true;

            switch (weaponIndexNumber)
            {
                case 0:
                    currentPlayerWeapon = new BaseballBat(new Vector2D(0, 0), .3f);
                    break;

                case 1:
                    currentPlayerWeapon = new CricketPlayer(new Vector2D(0, 0), .8f);
                    break;

                case 2:
                    currentPlayerWeapon = new Knife(new Vector2D(0, 0), .3f);
                    break;

                case 3:
                    currentPlayerWeapon = new Guitar(new Vector2D(0, 0), .5f);
                    break;

                case 4:
                    currentPlayerWeapon = new Katana(new Vector2D(0, 0), .3f);
                    break;

                case 5:
                    currentPlayerWeapon = new DildoSword(new Vector2D(0, 0), .3f);
                    break;

                case 6:
                    currentPlayerWeapon = new Axe(new Vector2D(0, 0), .2f);
                    break;

                case 7:
                    currentPlayerWeapon = new Beaver(new Vector2D(0, 0), .5f);
                    break;

                case 8:
                    currentPlayerWeapon = new ISISFlag(new Vector2D(0, 0), .5f);
                    break;

                case 9:
                    currentPlayerWeapon = new AssaultRifle(new Vector2D(0, 0), .2f);
                    break;

                case 10:
                    currentPlayerWeapon = new RPG(new Vector2D(0, 0), .3f);
                    break;

                case 11:
                    currentPlayerWeapon = new SMG(new Vector2D(0, 0), .3f);
                    break;

                case 12:
                    currentPlayerWeapon = new LMG(new Vector2D(0, 0), .3f);
                    break;

                case 13:
                    currentPlayerWeapon = new Pistol(new Vector2D(0, 0), .1f);
                    break;
            }
            GameWorld.GameWeapons.Add(currentPlayerWeapon); //add it to objects as it should get drawn
        }