private void CreateGuns() { Gun Pistol = new Gun(); Pistol.Type = GunType.Pistol; Pistol.AmmunitionLeft = GunsConstants.InfinityAmmunition();; Pistol.Ammunition = 7; Gun Submachinegun = new Gun(); Submachinegun.Type = GunType.SubMachinegun; Submachinegun.AmmunitionLeft = GunsConstants.EmptyMagazine(); Submachinegun.Ammunition = GunsConstants.EmptyMagazine(); Gun Machinegun = new Gun(); Machinegun.Type = GunType.Machinegun; Machinegun.AmmunitionLeft = GunsConstants.EmptyMagazine(); Machinegun.Ammunition = GunsConstants.EmptyMagazine(); guns = new Gun[3]; guns[GunsConstants.PistolGunType()] = Pistol; guns[GunsConstants.SubmachinegunGunType()] = Submachinegun; guns[GunsConstants.MachinegunGunType()] = Machinegun; }
public void Restart() { if (guns == null || guns.Length == 0) { CreateGuns(); } guns[GunsConstants.PistolGunType()].Ammunition = 7; guns[GunsConstants.SubmachinegunGunType()].AmmunitionLeft = GunsConstants.EmptyMagazine(); guns[GunsConstants.SubmachinegunGunType()].Ammunition = GunsConstants.EmptyMagazine(); guns[GunsConstants.MachinegunGunType()].AmmunitionLeft = GunsConstants.EmptyMagazine(); guns[GunsConstants.MachinegunGunType()].Ammunition = GunsConstants.EmptyMagazine(); playerLives = 1; }
public Gun CurrentGun() { if (guns[GunsConstants.MachinegunGunType()].AmmunitionLeft + guns[GunsConstants.MachinegunGunType()].Ammunition > GunsConstants.EmptyMagazine()) { return(guns[GunsConstants.MachinegunGunType()]); } else if (guns[GunsConstants.SubmachinegunGunType()].AmmunitionLeft + guns[GunsConstants.SubmachinegunGunType()].Ammunition > GunsConstants.EmptyMagazine()) { return(guns[GunsConstants.SubmachinegunGunType()]); } else { return(guns[GunsConstants.PistolGunType()]); } }