public void addMoneyEffect(U3D_Render.EntityView dieEv, ulong uMurderID) { if (dieEv == null || dieEv.CampFlag != SPELL.CampFlag.CampFlag_Enemy) { return; } U3D_Render.EntityView mainEv = EntityFactory.getMainPlayer(); if (mainEv == null || mainEv.StateMachine.GetState() == GameLogic.EntityState.Dead) { return; } Vector3 deadLoc = dieEv.gameObject.transform.position; Vector3 heroLoc = mainEv.gameObject.transform.position; if ((ulong)mainEv.ID == uMurderID) { int effectCount = 0; //根据死亡对象类型控制光效数量 //如果是怪物类型 if (dieEv.Type == ENTITY_TYPE.TYPE_MONSTER) { //中立野怪 //if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_WILD_MONSTER == dieEv.Flag) effectCount = 3; //小兵和野怪都是3个 } else if (dieEv.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE) { effectCount = 6; //英雄6个 } LightingEffectBehavior eff = EffectHelper.PlayAndReturnEffect(ref mainEv, GameLogicConfigApi.MoneyEffect, mainEv.ID, mainEv.ID, deadLoc, 0, 2); if (eff != null) { LightingEffectBehavior_Area effect = (LightingEffectBehavior_Area)eff; effect.SetEffectCount(effectCount); return; } } //别人杀死就没金币掉落 //int nMonsterDistance = GameLogicConfigApi.MonsterDistance; //int nTowerDistance = GameLogicConfigApi.TowerDistance; //if ((deadLoc - heroLoc).sqrMagnitude > (nMonsterDistance * nMonsterDistance)) // return; //IList<U3D_Render.EntityView> monster_Entities = MapFinderManager.Nearest(deadLoc, /*nTowerDistance*/nMonsterDistance, SPELL.CampFlag.CampFlag_Self); //if (monster_Entities == null) // return; //int nMainID = 0; //float fMinDis = 0.0f; //foreach (U3D_Render.EntityView monsterEv in monster_Entities) //{ // if (HeroDistanceMgr.CheckDistance(dieEv, monsterEv, nMonsterDistance) == false || monsterEv == null) // continue; // if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER == monsterEv.Flag) // { // //return; // } // else if (ENTITY_TYPE.TYPE_PLAYER_ROLE == monsterEv.Type) // { // float fEntityDistance = (deadLoc - monsterEv.gameObject.transform.position).sqrMagnitude; // if (fMinDis == 0 || fEntityDistance < fMinDis) // { // fMinDis = fEntityDistance; // nMainID = monsterEv.ID; // } // } //} //U3D_Render.EntityView view = EntityFactory.getEntityViewByID((int)uMurderID); //if (nMainID == mainEv.ID && (ulong)nMainID != uMurderID && (int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER != view.Flag) //{ // if ((view.InitMaskFlag & (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT) != (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT) // EffectHelper.Play(ref mainEv, GameLogicConfigApi.MonsterEffect, mainEv.ID, mainEv.ID, monsterLoc); //} }
public void addMonsterEffect(U3D_Render.EntityView dieEv, ulong uMurderID) { if (dieEv == null || dieEv.CampFlag != SPELL.CampFlag.CampFlag_Enemy || !CheckMonsterType(dieEv)) { return; } U3D_Render.EntityView mainEv = EntityFactory.getMainPlayer(); if (mainEv == null || mainEv.StateMachine.GetState() == GameLogic.EntityState.Dead) { return; } Vector3 monsterLoc = dieEv.gameObject.transform.position; Vector3 heroLoc = mainEv.gameObject.transform.position; int effectCount = 0; bool needPlayMoneyEffect = false; //根据死亡对象类型控制光效数量 int vocationID = dieEv.createinfo.nHeroID; string dieEffectMsg = ""; IntPtr strPtr = GameLogicAPI.toCoinLighting(vocationID, (int)ENTITY_TYPE.TYPE_MONSTER); if (strPtr != null) { dieEffectMsg = IntPtrHelper.Ptr2Str(strPtr); } if (dieEffectMsg.Contains(GameLogicConfigApi.MoneyEffect.ToString())) { needPlayMoneyEffect = true; } if ((ulong)mainEv.ID == uMurderID && GameLogicAPI.isInWarScene() != 0) { //如果是怪物类型 if (dieEv.Type == ENTITY_TYPE.TYPE_MONSTER) { //中立野怪 //if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_WILD_MONSTER == dieEv.Flag) effectCount = 3; //小兵和野怪都是3个 } else if (dieEv.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE) { effectCount = 6; //英雄6个 } if (effectCount > 0 && needPlayMoneyEffect) { LightingEffectBehavior moneyEff = EffectHelper.PlayAndReturnEffect(ref mainEv, GameLogicConfigApi.MoneyEffect, mainEv.ID, mainEv.ID, monsterLoc, 0, 2); if (moneyEff != null) { LightingEffectBehavior_Area effect = (LightingEffectBehavior_Area)moneyEff; effect.SetEffectCount(effectCount); } } LightingEffectBehavior deadEff = EffectHelper.PlayAndReturnEffect(ref dieEv, GameLogicConfigApi.MonsterDeadEffect, dieEv.ID, dieEv.ID, monsterLoc, 0, 2); return; } int nMonsterDistance = GameLogicConfigApi.MonsterDistance; int nTowerDistance = GameLogicConfigApi.TowerDistance; if ((monsterLoc - heroLoc).sqrMagnitude > (nMonsterDistance * nMonsterDistance)) { return; } IList <U3D_Render.EntityView> monster_Entities = MapFinderManager.Nearest(monsterLoc, /*nTowerDistance*/ nMonsterDistance, SPELL.CampFlag.CampFlag_Self); if (monster_Entities == null) { return; } int nMainID = 0; float fMinDis = 0.0f; foreach (U3D_Render.EntityView monsterEv in monster_Entities) { if (HeroDistanceMgr.CheckDistance(dieEv, monsterEv, nMonsterDistance) == false || monsterEv == null) { continue; } if ((int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER == monsterEv.Flag) { //return; } else if (ENTITY_TYPE.TYPE_PLAYER_ROLE == monsterEv.Type) { float fEntityDistance = (monsterLoc - monsterEv.gameObject.transform.position).sqrMagnitude; if (fMinDis == 0 || fEntityDistance < fMinDis) { fMinDis = fEntityDistance; nMainID = monsterEv.ID; } } } U3D_Render.EntityView view = EntityFactory.getEntityViewByID((int)uMurderID); if (nMainID == mainEv.ID && (ulong)nMainID != uMurderID && (int)MONSTER_SUB_TYPE.MONSTER_SUB_TYPE_DEFENSIVE_TOWER != view.Flag) { if ((view.InitMaskFlag & (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT) != (int)ENTITY_MASKFLAG.MASKFLAG_DIE_NO_COMMONLIGHT) { EffectHelper.Play(ref dieEv, GameLogicConfigApi.MonsterDeadEffect, dieEv.ID, mainEv.ID, monsterLoc); } } }