private void SelTarget() { WarServerNpcMgr npcMgr = WarServerManager.Instance.npcMgr; List <ServerLifeNpc> buildList = npcMgr.GetBuildByType(myHero.Camp, BuildNPCType.Tower); if (buildList == null || buildList.Count == 0) { ConsoleEx.DebugError("no tower find "); } int len = buildList.Count; float minDis = Mathf.Infinity; for (int i = 0; i < len; i++) { if (buildList[i].IsAlive) { float dis = AITools.GetSqrDis(mTrans.position, buildList[i].transform.position); if (dis < minDis) { minDis = dis; target = buildList[i]; } } } mTargetTrans = target.transform; targetPos = target.transform.forward * target.data.configData.seekRange * -1; distance = myHero.data.configData.radius + target.data.configData.radius + 2.0f; }
public override void OnStart() { npc = GetComponent <ServerLifeNpc>(); mTransform = npc.transform; npcMgr = WarServerManager.Instance.npcMgr; CAMP camp = CAMP.Player; if (npc.Camp == CAMP.Enemy) { camp = CAMP.Player; } else if (npc.Camp == CAMP.Player) { camp = CAMP.Enemy; } tower = npcMgr.GetBuildByType(camp, BuildNPCType.Tower); }
public override void OnStart() { mTransform = npc.transform; npcMgr = WarServerManager.Instance.npcMgr; distance = npc.data.configData.radius + 3.0f; }
/// <summary> /// 战斗结束 /// </summary> public void OnWarEnd() { serNpcMgr = null; cached = null; }
public void OnWarStart(WarServerNpcMgr npcMgr) { serNpcMgr = npcMgr; }
public override void OnAwake() { npc = GetComponent <ServerLifeNpc> (); npcMgr = WarServerManager.Instance.npcMgr; mTrans = npc.transform; }