Beispiel #1
0
        /// ------------------------------------------------------------------------------------------
        /// <summary>
        /// 行为的心跳帧
        /// </summary>
        /// ------------------------------------------------------------------------------------------
        private void FixedUpdate()
        {
            if (m_EntityAI == null)
            {
                m_EntityAI = GetComponent <AIToolkit.AIEntity>();
            }

            if (m_EntityAI != null)
            {
                GameObject target = GetLastestEnemy();
                if (target != null)
                {
                    m_EntityAI._targetDummyObject = target;
                }
            }
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// 刷新怪物
        /// </summary>
        /// ------------------------------------------------------------------------------------------------------------------------------
        void Spawn()
        {
            Npc        pNpc   = null;
            int        i      = Random.Range(0, spawnPoints.Count);
            GameObject pEnemy = Instantiate(enemy, spawnPoints[i].transform.position, spawnPoints[i].transform.rotation);
            HUDPlayer  hud    = HUDPlayerManager.Get().CreateHUDPlayerPrefab(pEnemy.transform);

            if (hud != null)
            {
                pNpc = pEnemy.GetComponent <Npc>();
                if (pNpc != null)
                {
                    pNpc.hudPlayer = hud;
                    pNpc.SetPlayerWeapon(0);
                }
            }
            mapObjectList.Add(pEnemy);
            AIToolkit.AIEntity pAIEntity = pEnemy.AddComponent <AIToolkit.AIEntity> ().Init(null);
            AIToolkit.AIEnityManager.instance.AddEntity(pAIEntity);
            if (pNpc != null)
            {
                pNpc.SetAIEntity(pAIEntity);
            }
        }
Beispiel #3
0
 public void SetAIEntity(AIToolkit.AIEntity ai)
 {
     m_EntityAI = ai;
 }