void SwitchWeapon(int i)
    {
        if (weapon_Inventory[0] != null && weapon_Inventory[1] != null)
        {
            //Switching Weapon
            switch (i)
            {
            case 0:
            {
                weapon_Inventory[0].gameObject.SetActive(true);
                weapon_Inventory[0].GetComponent <BaseGun>().weapon_Eqip = true;
                weapon_Inventory[1].GetComponent <BaseGun>().weapon_Eqip = false;
                weapon_Inventory[1].gameObject.SetActive(false);
                break;
            }

            case 1:
            {
                weapon_Inventory[0].gameObject.SetActive(false);
                weapon_Inventory[0].GetComponent <BaseGun>().weapon_Eqip = false;
                weapon_Inventory[1].gameObject.SetActive(true);
                weapon_Inventory[1].GetComponent <BaseGun>().weapon_Eqip = true;
                break;
            }
            }
        }
        //Update player weapon UI
        the_Player_UI_HUD.current_Weapon = weapon_Inventory[i];
        the_Player_UI_HUD.AmmoUpdate(i);
        the_Player_UI_HUD.WeaponNameUpdate(i);
    }
예제 #2
0
    public void SetValue()
    {
        //ammo pool
        the_Player_Manager = FindObjectOfType <PlayerManager>();
        the_Ammo_Pool      = FindObjectOfType <AmmoPool>();

        gun_current_Mag_Capacity = gun_Total_Mag_Capacity;
        //set up Weapon UI
        the_Player_UI_HUD = FindObjectOfType <PlayerUIHUD>();
        the_Player_UI_HUD.current_Weapon = this;
        the_Player_UI_HUD.AmmoUpdate(the_Player_Manager.current_Weapon);
        the_Player_UI_HUD.WeaponNameUpdate(the_Player_Manager.current_Weapon);
    }