private void SetCurrentWeapon(EnumWeapons _enumWeapon) { //no casteamos el arma en concreto hasta asignarla en currentWeapon switch (_enumWeapon) { //case EnumWeapons.GreatSword: // currentWeapon = (wGreatSword)GetWeaponByTag(_enumWeapon); // break; case EnumWeapons.GreatHammer: currentWeapon = (wGreatHammer)GetWeaponByTag(_enumWeapon); break; case EnumWeapons.KnightSword: currentWeapon = (wKnightSword)GetWeaponByTag(_enumWeapon); break; case EnumWeapons.KnightShield: currentShield = (wKnightShield)GetWeaponByTag(_enumWeapon); break; default: break; } HealthManager.instance.UpdateWeaponFrame(currentWeapon.WeaponSprite); Debug.Log("Arma cambiada a " + _enumWeapon.ToString()); }
private Weapon GetWeaponByTag(EnumWeapons _enumWeapon) { foreach (var weapon in playerWeapons) { if (weapon.tag == _enumWeapon.ToString()) { if (weapon.tag == EnumWeapons.KnightShield.ToString())//ToDo: no esta bien gestionado el tener el escudo en las armas { continue; } return(weapon.GetComponent <Weapon>()); } } return(null); }