void IncreaseAudioSourceRadius(EventParameter param)
 {
     //AudioSource.Radius = param.intParam;
     ActionDelayer.RunAfterDelay(() =>
     {
         //AudioSource.Radius = _startAudioRadius;
     }, param.floatParam);
 }
Exemple #2
0
 void ActivateEffect(EventParameter eventParam)
 {
     if (eventParam.materialParam != null)
     {
         Material material = eventParam.materialParam;
         material.SetFloat("_Lerp", 0);
         _effectMaterials.Add(material);
         StartCoroutine(LerpInCameraEffect(material, eventParam.floatParam2, false));
         ActionDelayer.RunAfterDelay(() => { StartCoroutine(LerpInCameraEffect(material, eventParam.floatParam2, true)); }, eventParam.floatParam);
     }
 }
Exemple #3
0
    public override bool PotionEffectStart(FPSMovement p)
    {
        switch (type)
        {
        case CharacterStatType.Jump:
            if (!p._jumpForce.GetStatModifiers().Exists(x => x.Source == this))
            {
                potionEffect = new StatModifier(flat, StatType.Flat, this);
                p._jumpForce.AddModifier(potionEffect, duration);
                p._jumpForce.AddModifier(new StatModifier(factor, StatType.PercentMult, this), duration);
                return(true);
            }
            break;

        case CharacterStatType.Gravity:
            if (!p._gravity.GetStatModifiers().Exists(x => x.Source == this))
            {
                potionEffect = new StatModifier(flat, StatType.Flat, this);
                p._gravity.AddModifier(potionEffect, duration);
                // p._gravity.AddModifier(new StatModifier(factor, StatType.PercentMult, this), duration);
                return(true);
            }
            break;

        default:
            if (!(p._speed.GetStatModifiers().Exists(x => x.Source == this)))
            {
                potionEffect = new StatModifier(flat, StatType.Flat, this);
                p._speed.AddModifier(potionEffect, duration);
                p._speed.AddModifier(new StatModifier(factor, StatType.PercentMult, this), duration);

                EventParameter param = new EventParameter()
                {
                    intParam = -50, floatParam = 1
                };
                EventManager.TriggerEvent(EventNameLibrary.SPEED_INCREASE, param);
                param.intParam = 0;
                ActionDelayer.RunAfterDelay(() =>
                {
                    EventManager.TriggerEvent(EventNameLibrary.SPEED_INCREASE, param);
                }, duration);
                return(true);
            }
            break;
        }
        return(false);
    }
Exemple #4
0
 //Set an effect for a certain amount of time
 public void ActivateImageEffect(Material material, float time)
 {
     _effectMaterials.Add(material);
     ActionDelayer.RunAfterDelay(() => { _effectMaterials.Remove(material); }, time);
 }
Exemple #5
0
    void AddAdditionalEffects()
    {
        ABILITY_FLAG flag = CharacterState.GetFlagFromString(effect);

        switch (flag)
        {
        case ABILITY_FLAG.INVISSIBLE:
            EventParameter paramI = new EventParameter()
            {
                intParam = 2, floatParam = 20f, floatParam2 = 1.0f
            };
            EventManager.TriggerEvent(EventNameLibrary.INVISSIBLE, paramI);
            paramI.floatParam  = 0.0f;
            paramI.floatParam2 = 0.01f;
            ActionDelayer.RunAfterDelay(() => { EventManager.TriggerEvent(EventNameLibrary.INVISSIBLE, paramI); }, duration);
            break;

        case ABILITY_FLAG.SUPERHEARING:
            //EventParameter param = new EventParameter() { intParam = 2, floatParam = 0.75f, floatParam2 = 1.0f };
            //EventManager.TriggerEvent(EventNameLibrary.SUPER_HEARING, param);
            //param.floatParam = 0.05f;
            //param.floatParam2 = 0.2f;
            //ActionDelayer.RunAfterDelay(() => {
            //EventManager.TriggerEvent(EventNameLibrary.SUPER_HEARING, param); }, duration);
            break;

        case ABILITY_FLAG.LEVITATE:

            ActionDelayer.RunAfterDelay(() => { CharacterState.AddAbilityFlag("SLOWFALL", 5f); }, duration);
            break;

        case ABILITY_FLAG.NULL:
            break;

        case ABILITY_FLAG.STONE:
            //EventManager.TriggerEvent(EventNameLibrary.STONED, new EventParameter { });
            break;

        case ABILITY_FLAG.SLOWFALL:
            break;

        case ABILITY_FLAG.CALM_ALL_FLOWERS:
            EventManager.TriggerEvent(EventNameLibrary.CALMING_POTION,
                                      new EventParameter());
            ActionDelayer.RunAfterDelay(() =>
            {
                EventManager.TriggerEvent(EventNameLibrary.CALMING_POTION,
                                          new EventParameter());
            }, duration);
            break;

        case ABILITY_FLAG.VISSION:
            EventManager.TriggerEvent(EventNameLibrary.VISSION_POTION,
                                      new EventParameter {
                floatParam = 8, floatParam2 = 6
            });
            ActionDelayer.RunAfterDelay(() =>
            {
                EventManager.TriggerEvent(EventNameLibrary.VISSION_POTION,
                                          new EventParameter {
                    floatParam = 2, floatParam2 = 1
                });
            }, duration);
            break;

        case ABILITY_FLAG.TELEPORT:
            EventManager.TriggerEvent(EventNameLibrary.TELEPOT, new EventParameter());
            break;

        default:
            break;
        }
    }