Пример #1
0
        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;
        }
Пример #2
0
        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);
        }
Пример #3
0
 public override void OnStart()
 {
     mTransform = npc.transform;
     npcMgr     = WarServerManager.Instance.npcMgr;
     distance   = npc.data.configData.radius + 3.0f;
 }
Пример #4
0
 /// <summary>
 /// 战斗结束
 /// </summary>
 public void OnWarEnd()
 {
     serNpcMgr = null;
     cached    = null;
 }
Пример #5
0
 public void OnWarStart(WarServerNpcMgr npcMgr)
 {
     serNpcMgr = npcMgr;
 }
Пример #6
0
 public override void OnAwake()
 {
     npc    = GetComponent <ServerLifeNpc> ();
     npcMgr = WarServerManager.Instance.npcMgr;
     mTrans = npc.transform;
 }