示例#1
0
 public Drop(Player.Weapon weapon, Sprite sprite, Vector2 velocity, int timeleft)
 {
     this.weapon   = weapon;
     this.sprite   = sprite;
     this.velocity = velocity;
     this.timeleft = timeleft;
 }
示例#2
0
        public static Drop[] DropWeapon(Player.Weapon weapon, Vector2 location, ContentManager Content, Drop[] drops)
        {
            Sprite sprite;

            if (weapon == Player.Weapon.LAZERSWORD)
            {
                sprite = new Sprite(Content.Load <Texture2D>("LazerSwordDrop"), location);
            }
            else if (weapon == Player.Weapon.HAMMER)
            {
                sprite = new Sprite(Content.Load <Texture2D>("HammerDrop"), location);
            }
            else if (weapon == Player.Weapon.ROCKETLAUNCHER)
            {
                sprite = new Sprite(Content.Load <Texture2D>("RocketLauncherDrop"), location);
            }
            else
            {
                sprite = new Sprite(Content.Load <Texture2D>("BasicWeaponDrop"), location);
            }
            Drop drop = new Drop(weapon, sprite, Vector2.Zero, 1000);

            if (drops != null && drops.Length != 0)
            {
                Drop[] newDrops = new Drop[drops.Length + 1];

                for (int i = 0; i < drops.Length; i++)
                {
                    newDrops[i + 1] = drops[i];
                }
                newDrops[0] = drop;
                drops       = newDrops;
                return(drops);
            }
            else
            {
                drops    = new Drop[1];
                drops[0] = drop;
                return(drops);
            }
        }
示例#3
0
 private Sprite GetPlayerWeaponTexture(Player player, ContentManager Content)
 {
     Player.Weapon weapon = player.weapon;
     if (weapon == Player.Weapon.BASIC)
     {
         return(new Sprite(Content.Load <Texture2D>("BasicWeapon"), player.sprite.vector));
     }
     if (weapon == Player.Weapon.LAZERSWORD)
     {
         return(player.lazerSword.sprite);
     }
     if (weapon == Player.Weapon.HAMMER)
     {
         return(player.hammer.sprite);
     }
     if (weapon == Player.Weapon.ROCKETLAUNCHER)
     {
         return(player.rocketLauncher.sprite);
     }
     return(null);
 }
示例#4
0
        public static Player.Weapon GetRandomWeapon()
        {
            Player.Weapon weapon;
            int           randomNum = (int)(random.NextDouble() * 4);

            if (randomNum == 1)
            {
                weapon = Player.Weapon.LAZERSWORD;
            }
            else if (randomNum == 2)
            {
                weapon = Player.Weapon.HAMMER;
            }
            else if (randomNum == 3)
            {
                weapon = Player.Weapon.ROCKETLAUNCHER;
            }
            else
            {
                weapon = Player.Weapon.BASIC;
            }
            return(weapon);
        }
示例#5
0
 public PlayerState(int health, Player.Weapon weapon, int ammo)
 {
     this.health = health;
     this.weapon = weapon;
     this.ammo   = ammo;
 }
示例#6
0
 public PlayerState(int health, Player.Weapon weapon, int ammo)
 {
     this.health = health;
     this.weapon = weapon;
     this.ammo = ammo;
 }