Beispiel #1
0
        private void KillBlackHole(bool doExplodeHit)
        {
            if ((this._fieldActor != null) && (this._fieldActor.triggerField != null))
            {
                List <uint> insideRuntimeIDs = this._fieldActor.GetInsideRuntimeIDs();
                this._fieldActor.triggerField.transform.position.y = 1f;
                for (int i = 0; i < insideRuntimeIDs.Count; i++)
                {
                    uint             runtimeID = insideRuntimeIDs[i];
                    BaseAbilityActor actor     = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(runtimeID);

                    if (((actor != null) && (actor.gameObject != null)) && ((this.config.ModifierNames != null) && (this.config.ModifierNames.Length > 0)))
                    {
                        int index  = 0;
                        int length = this.config.ModifierNames.Length;
                        while (index < length)
                        {
                            if (actor.abilityPlugin != null)
                            {
                                actor.abilityPlugin.TryRemoveModifier(base.instancedAbility, this.config.ModifierNames[index]);
                            }
                            index++;
                        }
                    }
                }
                if (doExplodeHit && (this.config.ExplodeAnimEventID != null))
                {
                    List <CollisionResult> list2 = CollisionDetectPattern.CylinderCollisionDetectBySphere(this._fieldActor.triggerField.XZPosition, this._fieldActor.triggerField.XZPosition, base.instancedAbility.Evaluate(this.config.Radius), 2f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, MixinTargetting.Enemy));
                    for (int j = 0; j < list2.Count; j++)
                    {
                        CollisionResult result = list2[j];
                        BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
                        if (collisionResultEntity != null)
                        {
                            Singleton <EventManager> .Instance.FireEvent(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), this.config.ExplodeAnimEventID, result.hitPoint, result.hitForward), MPEventDispatchMode.Normal);
                        }
                    }
                }
                base.FireMixinEffect(this.config.DestroyEffect, this._fieldActor.triggerField, false);
                this._fieldActor.Kill();
                this._blackHoleTimer.timespan = base.instancedAbility.Evaluate(this.config.Duration);
                this._blackHoleTimer.Reset(false);
                if ((this.config.CreationEffect != null) && (this.config.CreationEffect.EffectPattern != null))
                {
                    Singleton <EffectManager> .Instance.SetDestroyIndexedEffectPattern(this._blackHoleEffectIx);
                }
                foreach (KeyValuePair <BaseAbilityActor, int> pair in this._addedVelocityActorsAndIndexDic)
                {
                    if ((pair.Key != null) && (pair.Key.entity != null))
                    {
                        pair.Key.entity.SetAdditiveVelocityOfIndex(Vector3.zero, pair.Value);
                        pair.Key.entity.SetHasAdditiveVelocity(false);
                    }
                }
                this._addedVelocityActorsAndIndexDic.Clear();
            }
        }
Beispiel #2
0
 private void CreateExplode(Vector3 pos)
 {
     if (this.config.ExplodeAnimEventID != null)
     {
         List <CollisionResult> list = CollisionDetectPattern.CylinderCollisionDetectBySphere(pos, pos, this.config.ExplodeRadius, this.config.ExplodeRadius, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, MixinTargetting.Enemy));
         for (int i = 0; i < list.Count; i++)
         {
             CollisionResult result = list[i];
             BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
             if (collisionResultEntity != null)
             {
                 Singleton <EventManager> .Instance.FireEvent(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), this.config.ExplodeAnimEventID, result.hitPoint, result.hitForward), MPEventDispatchMode.Normal);
             }
         }
     }
 }
        protected override bool ListenBulletHit(EvtBulletHit evt)
        {
            if (!base._bulletAttackDatas.ContainsKey(evt.targetID))
            {
                return(false);
            }
            BaseMPIdentity identity = Singleton <MPManager> .Instance.TryGetIdentity(evt.otherID);

            if (((identity != null) && !identity.isAuthority) && !identity.remoteMode.IsRemoteReceive())
            {
                return(false);
            }
            AttackData attackData = base._bulletAttackDatas[evt.targetID];

            attackData.isFromBullet = true;
            bool           flag   = base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage;
            bool           flag2  = (base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage) || (base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDamageHitTarget);
            bool           flag3  = true;
            bool           flag4  = base.baseConfig.BulletHitType == BulletHitBehavior.NoDestroyAndRefresh;
            BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.otherID);

            BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor(evt.otherID) as BaseAbilityActor;

            if ((entity is MonoDummyDynamicObject) || ((identity != null) && !identity.remoteMode.IsRemoteReceive()))
            {
                flag2 = false;
                flag  = false;
                flag3 = false;
                flag4 = false;
            }
            else if (evt.hitEnvironment)
            {
                flag2 = true;
                flag4 = false;
            }
            else if ((!evt.cannotBeReflected && (actor != null)) && actor.abilityState.ContainsState(AbilityState.ReflectBullet))
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtAfterBulletReflected(evt.otherID, evt.targetID, base.actor.runtimeID, base._bulletAttackDatas[evt.targetID]), MPEventDispatchMode.Normal);

                return(false);
            }
            AbilityTriggerBullet bulletActor = Singleton <EventManager> .Instance.GetActor <AbilityTriggerBullet>(evt.targetID);

            if (flag2)
            {
                bulletActor.Kill();
                base._bulletAttackDatas.Remove(evt.targetID);
            }
            else
            {
                attackData = attackData.Clone();
            }
            if (flag4)
            {
                bulletActor.triggerBullet.ResetInside(base.baseConfig.ResetTime);
            }
            base._evtsLs.Clear();
            if (evt.hitEnvironment)
            {
                if (!evt.hitGround)
                {
                    return(true);
                }
                EvtHittingOther item = new EvtHittingOther(base.actor.runtimeID, evt.otherID, attackData)
                {
                    hitCollision = evt.hitCollision
                };
                base._evtsLs.Add(item);
            }
            else
            {
                attackData.hitCollision = evt.hitCollision;
                base._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, evt.otherID, base.baseConfig.HitAnimEventID, attackData));
            }
            if (flag)
            {
                List <CollisionResult> list = CollisionDetectPattern.CylinderCollisionDetectBySphere(evt.hitCollision.hitPoint, evt.hitCollision.hitPoint, base.instancedAbility.Evaluate(base.baseConfig.HitExplodeRadius), 1f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, base.baseConfig.Targetting));
                float y = evt.hitCollision.hitPoint.y;
                for (int j = 0; j < list.Count; j++)
                {
                    CollisionResult result = list[j];
                    BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
                    if ((collisionResultEntity != null) && (collisionResultEntity.GetRuntimeID() != evt.otherID))
                    {
                        result.hitPoint.y = y;
                        AttackData data2 = attackData.Clone();
                        AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                            hitDir   = result.hitForward,
                            hitPoint = result.hitPoint
                        };
                        data2.hitCollision = collsion;
                        base._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), base.baseConfig.HitAnimEventID, data2));
                    }
                }
            }
            if (flag3)
            {
                Vector3 hitPoint = evt.hitCollision.hitPoint;
                if (base.baseConfig.ExplodeEffectGround)
                {
                    hitPoint.y = 0f;
                }
                Vector3 hitDir = evt.hitCollision.hitDir;
                hitDir.y = 0f;
                base.FireTriggerBulletHitExplodeEffect(bulletActor, hitPoint, hitDir, false);
            }
            if (base.baseConfig.HitExplodeActions.Length > 0)
            {
                for (int k = 0; k < base._evtsLs.Count; k++)
                {
                    base.actor.abilityPlugin.HandleActionTargetDispatch(base.baseConfig.HitExplodeActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(base._evtsLs[k].toID), evt);
                }
            }
            for (int i = 0; i < base._evtsLs.Count; i++)
            {
                EvtHittingOther other2 = base._evtsLs[i];
                AttackPattern.SendHitEvent(base.actor.runtimeID, other2.toID, other2.animEventID, other2.hitCollision, other2.attackData, false, MPEventDispatchMode.CheckRemoteMode);
            }
            return(true);
        }
        protected virtual bool ListenBulletHit(EvtBulletHit evt)
        {
            if (!this._bulletAttackDatas.ContainsKey(evt.targetID))
            {
                return(false);
            }
            AttackData attackData = this._bulletAttackDatas[evt.targetID];

            attackData.isFromBullet = true;
            bool           flag   = this.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage;
            bool           flag2  = (this.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage) || (this.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDamageHitTarget);
            bool           flag3  = true;
            bool           flag4  = this.baseConfig.BulletHitType == BulletHitBehavior.NoDestroyAndRefresh;
            BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.otherID);

            BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor(evt.otherID) as BaseAbilityActor;

            if (entity is MonoDummyDynamicObject)
            {
                flag2 = false;
                flag  = false;
                flag3 = false;
                flag4 = false;
            }
            else if (evt.hitEnvironment)
            {
                flag2 = true;
                flag4 = false;
            }
            else if ((!evt.cannotBeReflected && (actor != null)) && actor.abilityState.ContainsState(AbilityState.ReflectBullet))
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtAfterBulletReflected(evt.otherID, evt.targetID, base.actor.runtimeID, this._bulletAttackDatas[evt.targetID]), MPEventDispatchMode.Normal);

                return(false);
            }
            AbilityTriggerBullet bulletActor = Singleton <EventManager> .Instance.GetActor <AbilityTriggerBullet>(evt.targetID);

            if (flag2)
            {
                if (bulletActor != null)
                {
                    bulletActor.Kill();
                }
                this._bulletAttackDatas.Remove(evt.targetID);
            }
            else
            {
                attackData = attackData.Clone();
            }
            if (flag4 && (bulletActor != null))
            {
                bulletActor.triggerBullet.ResetInside(this.baseConfig.ResetTime);
            }
            this._evtsLs.Clear();
            if (evt.hitEnvironment)
            {
                if (!evt.hitGround)
                {
                    return(true);
                }
                EvtHittingOther item = new EvtHittingOther(base.actor.runtimeID, evt.otherID, attackData)
                {
                    hitCollision = evt.hitCollision
                };
                this._evtsLs.Add(item);
            }
            else
            {
                attackData.hitCollision = evt.hitCollision;
                this._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, evt.otherID, this.baseConfig.HitAnimEventID, attackData));
            }
            if (flag)
            {
                List <CollisionResult> list = CollisionDetectPattern.CylinderCollisionDetectBySphere(evt.hitCollision.hitPoint, evt.hitCollision.hitPoint, base.instancedAbility.Evaluate(this.baseConfig.HitExplodeRadius), 1f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, this.baseConfig.Targetting));
                float y = evt.hitCollision.hitPoint.y;
                for (int j = 0; j < list.Count; j++)
                {
                    CollisionResult result = list[j];
                    BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
                    if ((collisionResultEntity != null) && (collisionResultEntity.GetRuntimeID() != evt.otherID))
                    {
                        result.hitPoint.y = y;
                        AttackData data2 = attackData.Clone();
                        AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                            hitDir   = result.hitForward,
                            hitPoint = result.hitPoint
                        };
                        data2.hitCollision = collsion;
                        this._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), this.baseConfig.HitAnimEventID, data2));
                    }
                }
            }
            if (flag3)
            {
                Vector3 hitPoint = evt.hitCollision.hitPoint;
                if (this.baseConfig.ExplodeEffectGround)
                {
                    hitPoint.y = 0f;
                }
                Vector3 hitDir = evt.hitCollision.hitDir;
                hitDir.y = 0f;
                bool selfExplode = evt.selfExplode;
                if (bulletActor != null)
                {
                    this.FireTriggerBulletHitExplodeEffect(bulletActor, hitPoint, hitDir, selfExplode);
                }
            }
            if ((this.baseConfig.HitExplodeActions.Length > 0) && (!evt.selfExplode || !this.baseConfig.MuteSelfHitExplodeActions))
            {
                for (int k = 0; k < this._evtsLs.Count; k++)
                {
                    if (base.actor.abilityPlugin != null)
                    {
                        base.actor.abilityPlugin.HandleActionTargetDispatch(this.baseConfig.HitExplodeActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(this._evtsLs[k].toID), evt);
                    }
                }
            }
            for (int i = 0; i < this._evtsLs.Count; i++)
            {
                EvtHittingOther other2 = this._evtsLs[i];
                if (this.baseConfig.IsHitChangeTargetDirection && (other2.attackData.hitEffect >= AttackResult.AnimatorHitEffect.ThrowUp))
                {
                    BaseAbilityActor actor2 = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(other2.toID);

                    if (actor2 != null)
                    {
                        actor2.entity.transform.forward = -other2.attackData.hitCollision.hitDir;
                    }
                }
                Singleton <EventManager> .Instance.FireEvent(other2, MPEventDispatchMode.Normal);
            }
            return(true);
        }