public void SetWeapon(ScriptableWeapons weapon)
    {
        this.weapon = weapon;

        if (weapon.weaponName == goodWeaponName)
        {
            //Activar script
            Debug.Log("Se esta utilizando el jabon");
            if (TryGetComponent(out shootSomething shootSomethingComponent))
            {
                shootSomethingComponent.enabled = true;
                hasWeapon = true;
            }
        }

        else if (weapon.weaponName == badWeaponName)
        {
            Debug.Log("Se esta utilizando el espray");
            if (TryGetComponent(out SprayShoot sprayShootComponent))
            {
                sprayShootComponent.enabled = true;
                hasWeapon = true;
            }
            else
            {
                Debug.LogError("No se encuentra el componente sprayshoot", this);
            }
        }

        else
        {
            Debug.LogError("No se reconoce el arma seleccionada", this);
        }
    }
    public void PickupGun(GameObject gun)
    {
        weaponStats = gun.GetComponent <WeaponStats>().weapon;
        hasGun      = true;
        GameObject scope    = Instantiate(weaponStats.prefabModelScoped, transform.position, transform.rotation, myCamera.transform);
        GameObject nonScope = Instantiate(weaponStats.prefabModel, transform.position, transform.rotation, myCamera.transform);

        scope.transform.position    = sniperScoped.transform.position;
        scope.transform.rotation    = sniperScoped.transform.rotation;
        sniperScoped                = scope;
        nonScope.transform.position = sniperNonScoped.transform.position;
        nonScope.transform.rotation = sniperNonScoped.transform.rotation;
        sniperNonScoped             = nonScope;
        Destroy(gun);
    }
示例#3
0
 private void GoodWeaponSelected()
 {
     disableHover();
     SetHover(hoverGoodWeapon);
     currentWeapon = goodWeapon;
 }
示例#4
0
 private void BadWeaponSelected()
 {
     disableHover();
     SetHover(hoverBadWeapon);
     currentWeapon = badWeapon;
 }