Esempio n. 1
0
    IEnumerator ActiveWeapon(GameObject p_goWeapon)
    {
        p_goWeapon.SetActive(true);
        myAnim.SetTrigger(TAKE_OUT);
        yield return(new WaitForSeconds(weaponSwapWaitTime));

        goCurrentWeapon = p_goWeapon;
        RangedWeapon t_weapon = p_goWeapon.GetComponent <RangedWeapon>();

        if (t_weapon != null && t_weapon.GetWeaponType() == WeaponType.RANGED)
        {
            if (t_weapon.GetWeaponName() != "Short Bow") // temp
            {
                goCrosshair.SetActive(true);
            }

            theCrosshair.SetGunAccuracy(t_weapon.GetAcuuracy());
            HUDWeapon.instance.SetAmmoUI(t_weapon.GetCurAmmo(), t_weapon.GetMagazineMax(), t_weapon.GetTotalAmmo());
            HUDWeapon.instance.SetWeaponName(t_weapon.GetWeaponName());
        }
        goCurrentWeapon.GetComponent <Weapon>().SetActivate(true);
    }