public void KillBoss() { List <ObjNPC> l = new List <ObjNPC>(); PushActionToAllObj(obj => { if (obj.GetObjType() != ObjType.NPC) { return; } ObjNPC npc = obj as ObjNPC; if (npc != null && npc.GetCamp() == 2) { l.Add(npc); } }); foreach (var npc in l) { npc.mDropOnDie = false; npc.Die(0, 0); } mTrigger = null; }
private ObjCharacter GetCanAttack(ObjNPC npc) { if (mLastEnemy == null || mLastEnemy.IsDead() || !mLastEnemy.Active) { ObjCharacter temp = null; var maxDis = 9999999.0f; foreach (var pair in npc.Scene.mObjDict) { var t = pair.Value as ObjCharacter; if (t == null || npc.Equals(t) || npc.GetCamp() == t.GetCamp()) { continue; } if (t.IsDead() || !t.Active) { continue; } /**if (!mAddList.Contains(t.TypeId)) * { * continue; * }**/ var dis = (npc.GetPosition() - t.GetPosition()).LengthSquared(); if (dis < maxDis) { temp = t; maxDis = dis; } } return(temp); } return(mLastEnemy); }
public override void OnNpcRespawn(ObjNPC npc) { if (null != npc && npc.GetCamp() == 2) { mMonsterCount++; BroadCastMonsterCount(); } }
public override void OnNpcEnter(ObjNPC npc) { if (null != npc && npc.GetCamp() == 2) { mMonsterCount++; BroadCastMonsterCount(); npc.OnBehaviourChangeCallback += OnNpcBehaviourChanged; } }
public override void OnNpcDie(ObjNPC npc, ulong characterId = 0) { base.OnNpcDie(npc, characterId); if (npc == null || npc.GetCamp() != 2) { return; } if (--mMonsterCount == 0) { OnWin(); } else { foreach (var objPlayer in EnumAllPlayer()) { objPlayer.Proxy.BroadcastSceneMonsterCount(mMonsterCount); } } BroadCastMonsterCount(); }