public override void PreDeath(Units attacker) { this.m_CoroutineManager.StopAllCoroutine(); base.EnableAction(false); this.data.OnDeath(attacker); this.surface.OnDeath(attacker); this.animController.OnDeath(attacker); if (this.aiManager != null) { this.aiManager.OnDeath(attacker); } if (this.moveController != null) { this.moveController.OnStop(); } if (this.atkController != null) { this.atkController.OnStop(); } Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitPrognosisDeath, this, null, null); if (attacker != null && (attacker.isHero || attacker.isPlayer) && attacker.unique_id != this.unique_id) { base.LastHurtHero = attacker; } if (base.isLocalUnit) { if (GlobalSettings.FogMode >= 2) { FOWSystem.CreateStaticTimeRevealer(base.transform.position, 1f, 3f); } else if (GlobalSettings.FogMode == 1) { FogMgr.Instance.AddFogItem(base.transform.position, 1f, 3f); } } }
private void DoEventDispatch(SkillDataKey skill_key, Units targetUnit, Units casterUnit) { if (targetUnit == null || casterUnit == null) { return; } SkillData data = GameManager.Instance.SkillData.GetData(skill_key); if (data == null) { return; } Skill skillOrAttackById = casterUnit.getSkillOrAttackById(data.skillId); if (skillOrAttackById == null) { return; } if (skillOrAttackById.IsAttack) { targetUnit.SetAttackedYouTarget(casterUnit); Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitAttackHitOther, casterUnit, null, null); } if (skillOrAttackById.IsSkill) { if (targetUnit.unique_id != base.unit.unique_id) { casterUnit.SetSkillHitedTarget(targetUnit); } if (casterUnit.isEnemy) { targetUnit.SetSkillHitedYouTarget(casterUnit); } Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitSkillHitOther, casterUnit, null, null); if (skillOrAttackById.skillIndex != 3) { Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitConjureQWE_HitOther, casterUnit, null, null); } } Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitHit, targetUnit, null, null); if (skillOrAttackById.IsAttack) { Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitBeAttackHit, targetUnit, null, null); } if (skillOrAttackById.IsSkill) { Singleton <TriggerManager> .Instance.SendUnitStateEvent(UnitEvent.UnitBeSkillHit, targetUnit, null, null); } if (StringUtils.CheckValid(base.unit.attackForTargetBuff)) { ActionManager.AddBuff(base.unit.attackForTargetBuff, targetUnit, casterUnit, true, string.Empty); casterUnit.attackForTargetBuff = string.Empty; } if (!casterUnit.isLocalUnit && targetUnit != null && targetUnit.isLocalUnit) { if (casterUnit.m_nVisibleState >= 2) { casterUnit.m_fVisibleTimer = 3f; } if (GlobalSettings.FogMode == 1) { if (casterUnit != null && FogMgr.Instance.IsInFog(casterUnit) && targetUnit.isLocalUnit) { FogMgr.Instance.AddFogItem(casterUnit, 1f, 3f); } } else if (GlobalSettings.FogMode >= 2 && casterUnit != null && !FOWSystem.Instance.IsVisible(casterUnit.transform.position) && targetUnit.isLocalUnit) { FOWSystem.CreateStaticTimeRevealer(casterUnit.transform.position, 1f, 3f); } } if (targetUnit == PlayerControlMgr.Instance.GetPlayer()) { Singleton <TriggerManager> .Instance.SendGameStateEvent(GameEvent.MainPlayerHitted); } }