Esempio n. 1
0
 private void SetupAvailableWeapons()
 {
     //Add all available weapons based on the weapon templates that were set in the inspector.
     //  Each weapon template has a corresponding weapon class, any unrecognised templates wil throw an error
     availableWeapons = new Weapon[availableWeaponTemplates.Length];
     for (int i = 0; i < availableWeaponTemplates.Length; i++)
     {
         if (availableWeaponTemplates[i] is GunWeaponTemplate gunTemplate)
         {
             availableWeapons[i] = new GunWeapon(this, gunTemplate);
         }
         else if (availableWeaponTemplates[i] is MeleeWeaponTemplate meleeTemplate)
         {
             availableWeapons[i] = new MeleeWeapon(this, meleeTemplate);
         }
         else if (availableWeaponTemplates[i] is GrenadeWeaponTemplate grenadeTemplate)
         {
             availableWeapons[i] = new GrenadeWeapon(this, grenadeTemplate);
         }
         else if (availableWeaponTemplates[i] is PrototypeWeaponTemplate prototypeTemplate)
         {
             availableWeapons[i] = new PrototypeWeapon(this, prototypeTemplate);
         }
         else
         {
             Debug.LogError("Unrecognised weapon type at setup: " + availableWeaponTemplates[i].GetWeaponName());
         }
     }
 }
Esempio n. 2
0
 private void CheckBullet()
 {
     currentGun          = theHandGunController.GetWeaponGun();
     testsBullet[0].text = currentGun.carryBulletCount.ToString();
     testsBullet[1].text = currentGun.reloadBulletCount.ToString();
     testsBullet[2].text = currentGun.currentBulletCount.ToString();
 }
Esempio n. 3
0
 private void FillWeaponList()
 {
     foreach (Transform weapon in this.gameObject.transform)
     {
         GunWeapon addedWeapon = weapon.GetComponent <GunWeapon>();
         if (addedWeapon)
         {
             playerWeapons.Add(addedWeapon);
         }
     }
 }
Esempio n. 4
0
    public virtual void GunWeaponChange(GunWeapon _gunWeapon)
    {
        if (WeaponManager.currentWeapon != null)
        {
            WeaponManager.currentWeapon.gameObject.SetActive(false);
            WeaponManager.currentWeapon.go_MainUI.SetActive(false);
        }

        currentGunWeapon = _gunWeapon;
        //WeaponManager.currentWeapon = currentGunWeapon.GetComponent<Transform>();
        WeaponManager.currentWeapon     = currentGunWeapon;
        WeaponManager.currentWeaponAnim = currentGunWeapon.anim;

        currentGunWeapon.transform.localPosition = Vector3.zero;
        currentGunWeapon.gameObject.SetActive(true);
        currentGunWeapon.go_MainUI.SetActive(true);
    }
Esempio n. 5
0
 public override void GunWeaponChange(GunWeapon _gunWeapon)
 {
     base.GunWeaponChange(_gunWeapon);
     isActivate = true;
 }
Esempio n. 6
0
 // Start is called before the first frame update
 void Awake()
 {
     this.virtualCameraNoise = this.virtualCamera.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();
     this.weapon             = this.GetComponent <GunWeapon>();
 }
Esempio n. 7
0
 private void ActivateNewWeapon()
 {
     playerWeapons[currentWeaponIndex].gameObject.SetActive(true);
     activeWeapon = playerWeapons[currentWeaponIndex];
 }
Esempio n. 8
0
 private void SetStartingWeapon()
 {
     currentWeaponIndex = 0;
     activeWeapon       = playerWeapons[currentWeaponIndex];
 }