Esempio n. 1
0
    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();
        }
    }
Esempio n. 2
0
    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;
    }
Esempio n. 3
0
    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;
    }
Esempio n. 4
0
 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()]);
     }
 }
Esempio n. 5
0
 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();
     }
 }
Esempio n. 6
0
    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)));
    }