public void AddMachinegunAmmo() { if (guns[GunsConstants.MachinegunGunType()].AmmunitionLeft == GunsConstants.EmptyMagazine() && guns[GunsConstants.MachinegunGunType()].Ammunition == GunsConstants.EmptyMagazine()) { guns[GunsConstants.MachinegunGunType()].Ammunition = GunsConstants.MachinegunMagazineCapacity(); guns[GunsConstants.MachinegunGunType()].AmmunitionLeft = GunsConstants.MachineStartAmmunitionLeftQuantity(); } else if (guns[GunsConstants.MachinegunGunType()].Ammunition == GunsConstants.EmptyMagazine()) { guns[GunsConstants.MachinegunGunType()].Ammunition += GunsConstants.MachinegunMagazineCapacity(); guns[GunsConstants.MachinegunGunType()].AmmunitionLeft += GunsConstants.MachinegunMagazineCapacity(); } else { guns[GunsConstants.MachinegunGunType()].AmmunitionLeft += GunsConstants.MachineStartAmmunitionLeftQuantity(); } if (guns[GunsConstants.MachinegunGunType()].Ammunition > GunsConstants.MachinegunMagazineCapacity()) { guns[GunsConstants.MachinegunGunType()].Ammunition = GunsConstants.MachinegunMagazineCapacity(); } if (guns[GunsConstants.MachinegunGunType()].AmmunitionLeft > GunsConstants.MachinegunTotalAmmunitionCapacity()) { guns[GunsConstants.MachinegunGunType()].AmmunitionLeft = GunsConstants.MachinegunTotalAmmunitionCapacity(); } }
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()]); } }
private void LoadGunController() { gunController = carriedGun.GetComponent <GunController>(); if (gunType == GunsConstants.SubmachinegunGunType()) { health = 2; gunController.MediumEnemyGun(); } else if (gunType == GunsConstants.MachinegunGunType()) { health = 3; gunController.SuperEnemyGun(); } else if (gunType == GunsConstants.BossGunType()) { health = 6; gunController.SuperEnemyGun(); } else { health = 1; gunController.BasicEnemyGun(); } }
public void SpawnGun(int gunType, Vector3 position) { int type = gunType == GunsConstants.BossGunType() ? GunsConstants.MachinegunGunType() : gunType; Instantiate(guns[type], position, Quaternion.Euler(new Vector3(0, 90, 0))); }