Пример #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag.Contains("Side"))
        {
            other.GetComponentInParent <BaseCharacter>().Buff_DebuffCo(new Buff_DebuffClass(ItemPowerUpInfo.Name, ItemPowerUpInfo.EffectDuration,
                                                                                            Random.Range(ItemPowerUpInfo.Value.x, ItemPowerUpInfo.Value.y),
                                                                                            ItemPowerUpInfo.StatsToAffect, ItemPowerUpInfo.StatsChecker, new ElementalResistenceClass(),
                                                                                            ElementalType.Neutral, ItemPowerUpInfo.AnimToFire, ItemPowerUpInfo.Particles));
            AudioClipInfoClass powerUpAudio = null;
            ItemType           itemType     = ItemType.PowerUP_FullRecovery;
            switch (ItemPowerUpInfo.StatsToAffect)
            {
            case (BuffDebuffStatsType.HealthStats_BaseHealthRegeneration):
                itemType     = ItemType.PowerUP_Health;
                powerUpAudio = BattleManagerScript.Instance.AudioProfile.PowerUp_Health;
                break;

            case (BuffDebuffStatsType.SpeedStats_BaseSpeed):
                itemType     = ItemType.PowerUp_Speed;
                powerUpAudio = BattleManagerScript.Instance.AudioProfile.PowerUp_Speed;
                break;

            case (BuffDebuffStatsType.StaminaStats_Stamina):
                itemType     = ItemType.PowerUP_Stamina;
                powerUpAudio = BattleManagerScript.Instance.AudioProfile.PowerUp_Stamina;
                break;

            case (BuffDebuffStatsType.RapidAttack_CriticalChance):
                itemType     = ItemType.PowerUp_Damage;
                powerUpAudio = BattleManagerScript.Instance.AudioProfile.PowerUp_Damage;
                break;

            case (BuffDebuffStatsType.DamageStats_BaseDamage):
                itemType     = ItemType.PowerUp_Damage;
                powerUpAudio = BattleManagerScript.Instance.AudioProfile.PowerUp_Damage;
                break;

            default:
                Debug.LogError("Error with potion type in event collection... Collected powerup effect is: " + ItemPowerUpInfo.StatsToAffect.ToString());
                break;
            }
            AudioManagerMk2.Instance.PlaySound(AudioSourceType.Game, powerUpAudio, AudioBus.MediumPriority, other.gameObject.transform);
            EventManager.Instance?.AddPotionCollected(itemType);
            gameObject.SetActive(false);
        }
    }
Пример #2
0
    public ManagedAudioSource PlaySound(AudioSourceType sourceType, AudioClipInfoClass clipInfo, AudioBus priority, Transform sourceOrigin = null, bool loop = false)
    {
        if (ClipPlayedThisFrame(clipInfo.Clip))
        {
            return(null);
        }

        ManagedAudioSource source = GetFreeSource(priority, sourceType);

        source.gameObject.SetActive(true);
        if (sourceOrigin != null)
        {
            source.SetParent(sourceOrigin);
        }
        source.SetAudioClipInfo(clipInfo);
        source.bus = priority;
        source.PlaySound(loop);
        AddClipPlayedLastFrame(clipInfo.Clip);

        UpdateActiveAudioVolumes();
        return(source);
    }
Пример #3
0
 public void SetAudioClipInfo(AudioClipInfoClass _audioClipInfo)
 {
     audioClipInfo = _audioClipInfo;
     source.clip   = audioClipInfo.Clip == null ? fallbackSound : audioClipInfo.ClipAndPlay;
     UpdateVolume();
 }