public EvtHittingOther(uint fromID, uint toID, string animEventID, Vector3 hitPoint, Vector3 hitForward) : this(fromID, toID, animEventID) { AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = hitPoint, hitDir = hitForward }; this.hitCollision = collsion; }
private bool OnBulletRefected(EvtAfterBulletReflected evt) { AbilityTriggerBullet bullet = Singleton <EventManager> .Instance.GetActor <AbilityTriggerBullet>(evt.bulletID); MonoTriggerBullet triggerBullet = bullet.triggerBullet; bullet.Setup(base.actor, triggerBullet.speed, MixinTargetting.All, triggerBullet.IgnoreTimeScale, triggerBullet.AliveDuration); evt.attackData.attackerAttackValue *= base.instancedAbility.Evaluate(this.config.DamageRatio); Vector3 position = Singleton <EventManager> .Instance.GetEntity(evt.launcherID).GetAttachPoint("RootNode").position; BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.launcherID); if (Vector3.Angle(base.instancedAbility.caster.entity.transform.forward, actor.entity.transform.position - base.instancedAbility.caster.entity.transform.position) < this.config.Angle) { if (this.config.IsReflectToLauncher) { triggerBullet.SetupTracing(position, triggerBullet._traceLerpCoef, triggerBullet._traceLerpCoefAcc, false); triggerBullet.transform.forward = -triggerBullet.transform.forward; } else { position.y += UnityEngine.Random.Range((float)1f, (float)3f); Vector3 rhs = position - base.entity.XZPosition; float sqrMagnitude = rhs.sqrMagnitude; rhs.y = 0f; Vector3 onUnitSphere = UnityEngine.Random.onUnitSphere; if (Vector3.Dot(onUnitSphere, rhs) < 0f) { onUnitSphere = -onUnitSphere; } onUnitSphere.y = Mathf.Abs(onUnitSphere.y); triggerBullet.transform.forward = onUnitSphere; triggerBullet.SetupTracing((Vector3)((onUnitSphere.normalized * sqrMagnitude) * 0.8f), triggerBullet._traceLerpCoef, triggerBullet._traceLerpCoefAcc, false); } if (this.config.ResetAliveDuration) { triggerBullet.AliveDuration = this.config.NewAliveDuration; } base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.ReflectSuccessActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(evt.launcherID), evt); } else { EvtBulletHit hit = new EvtBulletHit(triggerBullet.GetRuntimeID(), base.actor.runtimeID) { ownerID = base.actor.runtimeID, cannotBeReflected = true }; Vector3 vector4 = triggerBullet.transform.position - ((Vector3)((Time.deltaTime * triggerBullet.BulletTimeScale) * triggerBullet.transform.GetComponent <Rigidbody>().velocity)); AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = vector4, hitDir = triggerBullet.transform.forward }; hit.hitCollision = collsion; Singleton <EventManager> .Instance.FireEvent(hit, MPEventDispatchMode.Normal); } return(false); }
public static Offset <MPHitCollision> Serialize(FlatBufferBuilder builder, AttackResult.HitCollsion obj) { MPHitCollision.StartMPHitCollision(builder); Offset <MPVector3> hitDirOffset = Serialize(builder, obj.hitDir); MPHitCollision.AddHitDir(builder, hitDirOffset); Offset <MPVector3> hitPointOffset = Serialize(builder, obj.hitPoint); MPHitCollision.AddHitPoint(builder, hitPointOffset); return(MPHitCollision.EndMPHitCollision(builder)); }
public void AmendHitCollision(AttackResult attackResult) { if (attackResult.hitCollision == null) { AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = this.avatar.RootNodePosition, hitDir = -this.avatar.FaceDirection }; attackResult.hitCollision = collsion; } else if (attackResult.hitCollision.hitDir == Vector3.zero) { attackResult.hitCollision.hitPoint = this.avatar.RootNodePosition; attackResult.hitCollision.hitDir = -this.avatar.FaceDirection; } }
public static AttackResult.HitCollsion Deserialize(MPHitCollision table, AttackResult.HitCollsion obj) { if (obj == null) { obj = new AttackResult.HitCollsion(); } if (table.GetHitDir(GetCachedStruct <MPVector3>()) != null) { obj.hitDir = Deserialize(GetCachedStruct <MPVector3>()); } if (table.GetHitPoint(GetCachedStruct <MPVector3>()) != null) { obj.hitPoint = Deserialize(GetCachedStruct <MPVector3>()); } return(obj); }
private void OnTriggerEnter(Collider other) { if (((this._collisionMask.value & (((int)1) << other.gameObject.layer)) != 0) && this._collisionEnabled) { BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>(); if (Singleton <RuntimeIDManager> .Instance.ParseCategory(componentInParent.GetRuntimeID()) == 4) { if (this._enteredIDs.Contains(componentInParent.GetRuntimeID())) { return; } } else if (!componentInParent.IsActive() || this._enteredIDs.Contains(componentInParent.GetRuntimeID())) { return; } BaseMonoEntity owner = componentInParent; if (componentInParent is BaseMonoDynamicObject) { BaseMonoDynamicObject obj2 = (BaseMonoDynamicObject)componentInParent; if ((obj2.dynamicType == BaseMonoDynamicObject.DynamicType.EvadeDummy) && (obj2.owner != null)) { this._enteredIDs.Add(obj2.owner.GetRuntimeID()); } } else if (componentInParent is MonoBodyPartEntity) { owner = ((MonoBodyPartEntity)componentInParent).owner; } if (!(owner is BaseMonoAbilityEntity) || !((BaseMonoAbilityEntity)owner).isGhost) { this._enteredIDs.Add(owner.GetRuntimeID()); EvtBulletHit evt = new EvtBulletHit(base._runtimeID, owner.GetRuntimeID()) { ownerID = base.ownerID }; Vector3 position = base.transform.position - ((Vector3)((Time.deltaTime * this.BulletTimeScale) * this._rigidbody.velocity)); AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = other.ClosestPointOnBounds(position), hitDir = this.CreateHitForward() }; evt.hitCollision = collsion; Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal); } } }
private AttackResult.HitCollsion CalcHitCollision(ConfigPropObject.E_RetreatType retreatType, BaseMonoEntity victimEntity) { AttackResult.HitCollsion collsion = new AttackResult.HitCollsion(); if (retreatType == ConfigPropObject.E_RetreatType.Spike) { RaycastHit hit; collsion.hitPoint = victimEntity.GetAttachPoint("RootNode").position; Vector3 origin = victimEntity.transform.position + ((Vector3)(Vector3.up * 0.5f)); Vector3 direction = this.prop.transform.position - origin; if (Physics.Raycast(origin, direction, out hit, 10f, ((int)1) << InLevelData.PROP_LAYER)) { collsion.hitDir = hit.normal; } return(collsion); } collsion.hitPoint = base.entity.GetAttachPoint("RootNode").position; collsion.hitDir = base.entity.XZPosition - this.prop.XZPosition; return(collsion); }
private bool OnHittingOther(EvtHittingOther evt) { if (evt.attackData == null) { evt.attackData = DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(this, evt.animEventID); } if ((evt.attackData.hitCollision == null) && (evt.hitCollision != null)) { evt.attackData.hitCollision = evt.hitCollision; } else if (((evt.hitCollision == null) && (evt.attackData.hitCollision == null)) && (Singleton <EventManager> .Instance.GetActor(evt.toID) != null)) { BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.toID); AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = entity.GetAttachPoint("RootNode").position, hitDir = entity.XZPosition - this.monster.XZPosition }; evt.hitCollision = collsion; } return(true); }
public static void TestAndActHit(string attackName, ConfigEntityAttackPattern patternConfig, IAttacker attacker, List <CollisionResult> results) { AttackResult.HitCollsion collsion4; List <CollisionResult> list = FilterRealAttackeesByBodyParts(attackName, patternConfig, attacker, results); switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(attacker.GetRuntimeID())) { case 3: foreach (CollisionResult result in list) { BaseMonoEntity entity = result.entity; if (((entity != null) && (entity.GetRuntimeID() != attacker.GetRuntimeID())) && (entity.IsActive() || (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity.GetRuntimeID()) == 4))) { switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity.GetRuntimeID())) { case 3: case 4: case 6: case 7: if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity.GetRuntimeID())) { goto Label_0103; } break; } } continue; Label_0103: collsion4 = new AttackResult.HitCollsion(); collsion4.hitDir = result.hitForward; collsion4.hitPoint = result.hitPoint; AttackResult.HitCollsion hitCollision = collsion4; SendHitEvent(attacker.GetRuntimeID(), entity.GetRuntimeID(), attackName, hitCollision, null, false, MPEventDispatchMode.CheckRemoteMode); } return; case 4: foreach (CollisionResult result2 in list) { BaseMonoEntity entity2 = result2.entity; if (((entity2 != null) && (entity2.GetRuntimeID() != attacker.GetRuntimeID())) && entity2.IsActive()) { switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity2.GetRuntimeID())) { case 3: case 4: case 6: if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity2.GetRuntimeID())) { goto Label_021F; } break; } } continue; Label_021F: collsion4 = new AttackResult.HitCollsion(); collsion4.hitDir = result2.hitForward; collsion4.hitPoint = result2.hitPoint; AttackResult.HitCollsion collsion2 = collsion4; SendHitEvent(attacker.GetRuntimeID(), entity2.GetRuntimeID(), attackName, collsion2, null, false, MPEventDispatchMode.CheckRemoteMode); } return; case 7: foreach (CollisionResult result3 in list) { BaseMonoEntity entity3 = result3.entity; if (((entity3 != null) && (entity3.GetRuntimeID() != attacker.GetRuntimeID())) && entity3.IsActive()) { switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity3.GetRuntimeID())) { case 3: case 4: case 6: if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity3.GetRuntimeID())) { goto Label_033F; } break; } } continue; Label_033F: collsion4 = new AttackResult.HitCollsion(); collsion4.hitDir = result3.hitForward; collsion4.hitPoint = result3.hitPoint; AttackResult.HitCollsion collsion3 = collsion4; SendHitEvent(attacker.GetRuntimeID(), entity3.GetRuntimeID(), attackName, collsion3, null, false, MPEventDispatchMode.CheckRemoteMode); } return; } throw new Exception("Invalid Type or State!"); }
public static void SendHitEvent(uint attackerID, uint beHitID, string attackName, AttackResult.HitCollsion hitCollision, AttackData attackData, bool forceSkipAttackerResolve = false, MPEventDispatchMode mode = 0) { if (forceSkipAttackerResolve || Singleton <LevelManager> .Instance.gameMode.ShouldAttackPatternSendBeingHit(beHitID)) { EvtBeingHit evt = new EvtBeingHit { targetID = beHitID, sourceID = attackerID, animEventID = attackName }; if (attackData != null) { if (attackData.hitCollision == null) { attackData.hitCollision = hitCollision; } evt.attackData = attackData; } else { evt.attackData = DamageModelLogic.CreateAttackDataFromAttackerAnimEvent(Singleton <EventManager> .Instance.GetActor(attackerID), attackName); evt.attackData.resolveStep = AttackData.AttackDataStep.AttackerResolved; evt.attackData.hitCollision = hitCollision; } Singleton <EventManager> .Instance.FireEvent(evt, mode); } else { EvtHittingOther other = new EvtHittingOther { hitCollision = hitCollision, targetID = attackerID, toID = beHitID, animEventID = attackName }; if (attackData != null) { if (attackData.hitCollision == null) { attackData.hitCollision = hitCollision; } other.attackData = attackData; } else { other.hitCollision = hitCollision; } Singleton <EventManager> .Instance.FireEvent(other, mode); } }
protected override void Update() { AttackResult.HitCollsion collsion; base.Update(); if (this._resetTimer != null) { this._resetTimer.Core(1f); if (this._resetTimer.isTimeUp) { this._enteredIDs.Clear(); this._resetTimer.Reset(false); } } if (this._aliveTimer.isActive) { this._aliveTimer.Core(this.BulletTimeScale); if (this._aliveTimer.isTimeUp) { EvtBulletHit evt = new EvtBulletHit(base._runtimeID) { ownerID = base.ownerID }; collsion = new AttackResult.HitCollsion { hitDir = this.CreateHitForward(), hitPoint = base.transform.position }; evt.hitCollision = collsion; evt.hitGround = true; evt.selfExplode = true; Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal); this._aliveTimer.Reset(false); } } if (InLevelData.IsOutOfStage(this.XZPosition)) { EvtBulletHit hit2 = new EvtBulletHit(base._runtimeID) { ownerID = base.ownerID }; collsion = new AttackResult.HitCollsion { hitDir = this.CreateHitForward(), hitPoint = base.transform.position }; hit2.hitCollision = collsion; Singleton <EventManager> .Instance.FireEvent(hit2, MPEventDispatchMode.Normal); } else if ((base.transform.position.y < 0.05f) && this._collisionEnabled) { EvtBulletHit hit3 = new EvtBulletHit(base._runtimeID) { ownerID = base.ownerID }; collsion = new AttackResult.HitCollsion { hitDir = this.CreateHitForward(), hitPoint = base.transform.position }; hit3.hitCollision = collsion; hit3.hitGround = true; Singleton <EventManager> .Instance.FireEvent(hit3, MPEventDispatchMode.Normal); } else if (this._state == BulletState.Linear) { this.speed += (this.acceleration * Time.deltaTime) * this.BulletTimeScale; this._rigidbody.velocity = (Vector3)((this.speed * base.transform.forward) * this.BulletTimeScale); } else if (this._state == BulletState.TracePosition) { this._traceLerpCoef += (this._traceLerpCoefAcc * Time.deltaTime) * this.BulletTimeScale; Vector3 forward = base.transform.forward; Vector3 vector3 = this._targetPosition - this._rigidbody.position; if (vector3.magnitude >= this.targetReachThreshold) { forward = Vector3.Normalize(this._targetPosition - this._rigidbody.position); float num = Vector3.Angle(forward, base.transform.forward); if (!this._passBy || (num < 90.0)) { base.transform.forward = Vector3.Slerp(base.transform.forward, forward, (Time.deltaTime * this.BulletTimeScale) * this._traceLerpCoef); } this.speed += (this.acceleration * Time.deltaTime) * this.BulletTimeScale; this._rigidbody.velocity = (Vector3)(((this.speed * base.transform.forward) + this.speedAdd) * this.BulletTimeScale); } else { this._rigidbody.velocity = (Vector3)(base.transform.forward * 0f); if (this._collisionEnabled) { EvtBulletHit hit4 = new EvtBulletHit(base._runtimeID) { ownerID = base.ownerID }; collsion = new AttackResult.HitCollsion { hitDir = this.CreateHitForward(), hitPoint = base.transform.position }; hit4.hitCollision = collsion; hit4.hitGround = true; Singleton <EventManager> .Instance.FireEvent(hit4, MPEventDispatchMode.Normal); } } } else if (((this._state == BulletState.Placing) && (this._placingTimer != null)) && this._placingTimer.isActive) { this._placingTimer.Core(this.BulletTimeScale); if (!this._placingTimer.isTimeUp) { base.transform.position = Vector3.Slerp(this._originalPosition, this._placingPosition, this._placingTimer.timer / this._placingTimer.timespan); this._collisionEnabled = false; this._collisionMask = -1; this._rigidbody.velocity = (Vector3)((this.speed * base.transform.forward) * this.BulletTimeScale); } else { this._state = BulletState.TracePosition; this._placingTimer.Reset(false); this.speed = this._resumeSpeed; this._collisionEnabled = true; } } }
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); }
private bool OnBeingHitResolve(EvtBeingHit evt) { evt.Resolve(); AttackResult attackResult = DamageModelLogic.ResolveAttackDataFinal(this, evt.attackData); if (attackResult.hitCollision == null) { AttackResult.HitCollsion collsion = new AttackResult.HitCollsion { hitPoint = this.prop.RootNode.position, hitDir = -this.prop.transform.forward }; attackResult.hitCollision = collsion; } if (!evt.attackData.isAnimEventAttack) { return(false); } if (base.isAlive != 0) { float totalDamage = attackResult.GetTotalDamage(); float newValue = base.HP - totalDamage; if (newValue <= 0f) { newValue = 0f; } DelegateUtils.UpdateField(ref this.HP, newValue, newValue - base.HP, base.onHPChanged); if (base.HP == 0f) { if (base.abilityState.ContainsState(AbilityState.Limbo)) { this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID); } else { this.BeingHit(attackResult, BeHitEffect.KillingBeHit, evt.sourceID); this.Kill(evt.sourceID, evt.animEventID); } } else { this.BeingHit(attackResult, BeHitEffect.NormalBeHit, evt.sourceID); } } if ((attackResult.attackEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyAttack))) { AttackPattern.ActAttackEffects(attackResult.attackEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir); } if ((attackResult.beHitEffectPattern != null) && ((attackResult.hitEffectPattern == AttackResult.HitEffectPattern.Normal) || (attackResult.hitEffectPattern == AttackResult.HitEffectPattern.OnlyBeHit))) { AttackPattern.ActAttackEffects(attackResult.beHitEffectPattern, this.prop, attackResult.hitCollision.hitPoint, attackResult.hitCollision.hitDir); } if (evt.attackData.isAnimEventAttack) { EvtAttackLanded landed = new EvtAttackLanded(evt.sourceID, base.runtimeID, evt.animEventID, attackResult); Singleton <EventManager> .Instance.FireEvent(landed, MPEventDispatchMode.Normal); Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.AttackLanded, landed)); } else { Singleton <EventManager> .Instance.FireEvent(new EvtDamageLanded(evt.sourceID, base.runtimeID, attackResult), MPEventDispatchMode.Normal); } return(true); }
public static object DeserializeToObject(Table table, object obj) { if (table.GetType() == typeof(MoleMole.MPProtocol.MPStageData)) { if (obj == null) { obj = new MoleMole.MPStageData(); } return(Deserialize((MoleMole.MPProtocol.MPStageData)table, (MoleMole.MPStageData)obj)); } if (table.GetType() == typeof(MoleMole.MPProtocol.MPAvatarDataItem)) { if (obj == null) { obj = new MoleMole.MPAvatarDataItem(); } return(Deserialize((MoleMole.MPProtocol.MPAvatarDataItem)table, (MoleMole.MPAvatarDataItem)obj)); } if (table.GetType() == typeof(Packet_Event_EvtHittingOther)) { if (obj == null) { obj = new EvtHittingOther(); } return(Deserialize((Packet_Event_EvtHittingOther)table, (EvtHittingOther)obj)); } if (table.GetType() == typeof(Packet_Event_EvtBeingHit)) { if (obj == null) { obj = new EvtBeingHit(); } return(Deserialize((Packet_Event_EvtBeingHit)table, (EvtBeingHit)obj)); } if (table.GetType() == typeof(Packet_Event_EvtAttackLanded)) { if (obj == null) { obj = new EvtAttackLanded(); } return(Deserialize((Packet_Event_EvtAttackLanded)table, (EvtAttackLanded)obj)); } if (table.GetType() == typeof(Packet_Event_EvtEvadeSuccess)) { if (obj == null) { obj = new EvtEvadeSuccess(); } return(Deserialize((Packet_Event_EvtEvadeSuccess)table, (EvtEvadeSuccess)obj)); } if (table.GetType() == typeof(Packet_Event_EvtBulletHit)) { if (obj == null) { obj = new EvtBulletHit(); } return(Deserialize((Packet_Event_EvtBulletHit)table, (EvtBulletHit)obj)); } if (table.GetType() == typeof(MPAttackData)) { if (obj == null) { obj = new AttackData(); } return(Deserialize((MPAttackData)table, (AttackData)obj)); } if (table.GetType() == typeof(MPAttackResult)) { if (obj == null) { obj = new AttackResult(); } return(Deserialize((MPAttackResult)table, (AttackResult)obj)); } if (table.GetType() != typeof(MPHitCollision)) { return(obj); } if (obj == null) { obj = new AttackResult.HitCollsion(); } return(Deserialize((MPHitCollision)table, (AttackResult.HitCollsion)obj)); }