示例#1
0
        private void UpdateShieldEffect()
        {
            MixinEffect effect = this.config.ShieldEffects[0];
            float       a      = this._globalShieldValue.Value / this._totalShieldValue;

            if (Mathf.Approximately(a, 0f))
            {
                this.RemoveEffect();
            }
            else
            {
                for (int i = 0; i < this._shieldEffectRange.Length; i++)
                {
                    if (a <= this._shieldEffectRange[i])
                    {
                        effect = this.config.ShieldEffects[i];
                        break;
                    }
                }
                if (this._currentMixinEffect != effect)
                {
                    if (this._currentMixinEffect != null)
                    {
                        base.entity.DetachEffect(this._shieldEffectPatternIx);
                    }
                    this._currentMixinEffect    = effect;
                    this._shieldEffectPatternIx = base.entity.AttachEffect(effect.EffectPattern);
                }
            }
        }
示例#2
0
 public void FireMixinEffect(MixinEffect effectConfig, BaseMonoEntity target, Vector3 pos, Vector3 forward, bool allowInactiveFire = false)
 {
     if ((effectConfig != null) && (target != null))
     {
         bool flag = false;
         if (allowInactiveFire)
         {
             flag = true;
         }
         else if (this.entity.gameObject.activeSelf)
         {
             flag = true;
         }
         if (flag)
         {
             if (effectConfig.EffectPattern != null)
             {
                 this.entity.FireEffect(effectConfig.EffectPattern, pos, forward);
             }
             if (effectConfig.AudioPattern != null)
             {
                 this.entity.PlayAudio(effectConfig.AudioPattern, target.transform);
             }
         }
     }
 }
示例#3
0
 private void RemoveEffect()
 {
     if (this._currentMixinEffect != null)
     {
         base.entity.DetachEffect(this._shieldEffectPatternIx);
     }
     this._currentMixinEffect = null;
 }
示例#4
0
 public int AttachMixinEffect(MixinEffect effectConfig)
 {
     if (effectConfig.AudioPattern != null)
     {
         this.entity.PlayAudio(effectConfig.AudioPattern, this.entity.transform);
     }
     return(this.entity.AttachEffect(effectConfig.EffectPattern));
 }
示例#5
0
 private void SummonEffect(Vector3 position, MixinEffect effect)
 {
     if (effect != null)
     {
         if (effect.EffectPattern != null)
         {
             base.entity.FireEffect(effect.EffectPattern, position, Vector3.forward);
         }
         if (effect.AudioPattern != null)
         {
             base.entity.PlayAudio(effect.AudioPattern);
         }
     }
 }
示例#6
0
        private void SkillIDChangedCallback(string from, string to)
        {
            if (this._state == State.Idle)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    if (this.IsTriggerCharging())
                    {
                        this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                        this._monster.SetTrigger(this.config.NextLoopTriggerID);
                        this._state  = State.Before;
                        this._loopIx = 0;
                    }
                    else
                    {
                        this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                        this._monster.SetTrigger(this.config.AfterSkillTriggerID);
                    }
                }
            }
            else if (this._state == State.Before)
            {
                if (to == this.config.ChargeLoopSkillIDs[this._loopIx])
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        MixinEffect effect = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect.EffectPattern);
                        }
                        if (effect.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect.AudioPattern;
                            base.entity.PlayAudio(effect.AudioPattern);
                        }
                    }
                    this._state = State.InLoop;
                    this._chargeTimer.timespan = this.config.ChargeLoopDurations[this._loopIx] * this._chargeTimeRatio;
                    this._chargeTimer.Reset(true);
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.After;
                }
                else if (!Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
            else if (this._state == State.InLoop)
            {
                if (Miscs.ArrayContains <string>(this.config.ChargeLoopSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        base.entity.DetachEffect(this._chargeEffectPatternIx);
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                        MixinEffect effect2 = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect2.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect2.EffectPattern);
                        }
                        if (effect2.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect2.AudioPattern;
                            base.entity.PlayAudio(effect2.AudioPattern);
                        }
                        if (this.config.ChargeSwitchEffects != null)
                        {
                            base.FireMixinEffect(this.config.ChargeSwitchEffects[this._loopIx - 1], base.entity, false);
                        }
                    }
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    EvtChargeRelease evt = new EvtChargeRelease(base.actor.runtimeID, to)
                    {
                        isSwitchRelease = this._switchTimer.isActive && !this._switchTimer.isTimeUp
                    };
                    Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);

                    this._switchTimer.Reset(false);
                    this._chargeTimer.Reset(false);
                    this._state = State.After;
                }
                else
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
            else if (this._state == State.After)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to) && this.IsTriggerCharging())
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.SetTrigger(this.config.NextLoopTriggerID);
                    this._state  = State.Before;
                    this._loopIx = 0;
                }
                else
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
        }
        private void SkillIDChangedCallback(string from, string to)
        {
            if (this._state == State.Idle)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    this.SkillIDChangedToBefore();
                }
            }
            else if (this._state == State.Before)
            {
                if (to == this.config.ChargeLoopSkillIDs[this._loopIx])
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        MixinEffect effect = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect.EffectPattern);
                        }
                        if (effect.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect.AudioPattern;
                            base.entity.PlayAudio(effect.AudioPattern);
                        }
                    }
                    this._state = State.InLoop;
                    this.OnBeforeToInLoop();
                    if (this.config.ChargeSubTargetAmount != null)
                    {
                        int targetAmount = this.config.ChargeSubTargetAmount[this._loopIx];
                        this.SelectSubTargets(targetAmount);
                    }
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.After;
                }
                else if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, from))
                    {
                        this.SkillIDChangedToBefore();
                    }
                }
                else
                {
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
            else if (this._state == State.InLoop)
            {
                if (Miscs.ArrayContains <string>(this.config.ChargeLoopSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        if (this.config.ImmediatelyDetachLoopEffect)
                        {
                            base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        }
                        else
                        {
                            base.entity.DetachEffect(this._chargeEffectPatternIx);
                        }
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                        MixinEffect effect2 = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect2.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect2.EffectPattern);
                        }
                        if (effect2.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect2.AudioPattern;
                            base.entity.PlayAudio(effect2.AudioPattern);
                        }
                        if (this.config.ChargeSwitchEffects != null)
                        {
                            base.FireMixinEffect(this.config.ChargeSwitchEffects[this._loopIx - 1], base.entity, false);
                        }
                    }
                    this._switchTimer.Reset(true);
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        if (this.config.ImmediatelyDetachLoopEffect)
                        {
                            base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        }
                        else
                        {
                            base.entity.DetachEffect(this._chargeEffectPatternIx);
                        }
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    EvtChargeRelease evt = new EvtChargeRelease(base.actor.runtimeID, to)
                    {
                        isSwitchRelease = this._switchTimer.isActive && !this._switchTimer.isTimeUp
                    };
                    Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);

                    this._switchTimer.Reset(false);
                    this._state = State.After;
                    this.OnInLoopToAfter();
                }
                else
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        if (this.config.ImmediatelyDetachLoopEffect)
                        {
                            base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        }
                        else
                        {
                            base.entity.DetachEffect(this._chargeEffectPatternIx);
                        }
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                    this.ClearSubTargets();
                }
            }
            else if (this._state == State.After)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    this.SkillIDChangedToBefore();
                }
                else
                {
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
                this.ClearSubTargets();
            }
        }