Example #1
0
 public void InitializePlayerWeapon()
 {
     currentWeapon = _currentWeapon.WEAPON1;
     HUDWeapon1    = GameObject.Find("Canvas").transform.Find("Weapon Panel BG").transform.Find("Weapon Panel").transform.Find("HUD 1").gameObject;
     HUDWeapon2    = GameObject.Find("Canvas").transform.Find("Weapon Panel BG").transform.Find("Weapon Panel").transform.Find("HUD 2").gameObject;
     HUDWeapon3    = GameObject.Find("Canvas").transform.Find("Weapon Panel BG").transform.Find("Weapon Panel").transform.Find("HUD 3").gameObject;
     HUDWeapon1.GetComponent <Image>().color = new Color(1, 1, 1, 1f);
     HUDWeapon2.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
     HUDWeapon3.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
 }
Example #2
0
 private void CheckWeapon()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1) && currentWeapon != _currentWeapon.WEAPON1 && WeaponUnlocks.unlocks[0] != 0)
     {
         currentWeapon = _currentWeapon.WEAPON1;
         HUDWeapon1.GetComponent <Image>().color = new Color(1, 1, 1, 1f);
         HUDWeapon2.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
         HUDWeapon3.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
         if (WeaponUnlocks.unlocks[0] == 1)
         {
             player.GetComponent <PlayerController>().myBulletType = PlayerController.BulletType.NORMAL1;
         }
         else if (WeaponUnlocks.unlocks[0] == 2)
         {
             player.GetComponent <PlayerController>().myBulletType = PlayerController.BulletType.NORMAL2;
         }
     }
     else if (Input.GetKeyDown(KeyCode.Alpha2) && currentWeapon != _currentWeapon.WEAPON2 && WeaponUnlocks.unlocks[1] != 0)
     {
         currentWeapon = _currentWeapon.WEAPON2;
         HUDWeapon1.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
         HUDWeapon2.GetComponent <Image>().color = new Color(1, 1, 1, 1f);
         HUDWeapon3.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
         if (WeaponUnlocks.unlocks[0] == 1)
         {
             player.GetComponent <PlayerController>().myBulletType = PlayerController.BulletType.RICOCHET1;
         }
         else if (WeaponUnlocks.unlocks[0] == 2)
         {
             player.GetComponent <PlayerController>().myBulletType = PlayerController.BulletType.RICOCHET2;
         }
     }
     else if (Input.GetKeyDown(KeyCode.Alpha3) && currentWeapon != _currentWeapon.WEAPON3 && WeaponUnlocks.unlocks[2] != 0)
     {
         currentWeapon = _currentWeapon.WEAPON3;
         HUDWeapon1.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
         HUDWeapon2.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
         HUDWeapon3.GetComponent <Image>().color = new Color(1, 1, 1, 1f);
         if (WeaponUnlocks.unlocks[0] == 1)
         {
             player.GetComponent <PlayerController>().myBulletType = PlayerController.BulletType.PENETRATE1;
         }
         else if (WeaponUnlocks.unlocks[0] == 2)
         {
             player.GetComponent <PlayerController>().myBulletType = PlayerController.BulletType.PENETRATE2;
         }
     }
 }
Example #3
0
 private void Start()
 {
     try
     {
         player = GameObject.Find("Player").gameObject;
     }
     catch
     { }
     //setting start weapon
     currentWeapon = _currentWeapon.WEAPON1;
     HUDWeapon1.GetComponent <Image>().color = new Color(1, 1, 1, 1f);
     HUDWeapon2.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
     HUDWeapon3.GetComponent <Image>().color = new Color(1, 1, 1, 0.2f);
     try
     {
         HUDWeapon1 = GameObject.Find("Canvas").transform.Find("Weapon Panel BG").transform.Find("Weapon Panel").transform.Find("HUD 1").gameObject;
         HUDWeapon2 = GameObject.Find("Canvas").transform.Find("Weapon Panel BG").transform.Find("Weapon Panel").transform.Find("HUD 2").gameObject;
         HUDWeapon3 = GameObject.Find("Canvas").transform.Find("Weapon Panel BG").transform.Find("Weapon Panel").transform.Find("HUD 3").gameObject;
     }
     catch
     {
     }
 }
 set => SetProperty(ref _currentWeapon, value);