Exemplo n.º 1
0
    public void ReleaseCombineEnemyAI(CombineEnemyAIStateController ai, float t)
    {
        ai.StopListen();
        Destroy(ai.targetPos.gameObject);
        Destroy(ai.Role.gameObject, t);
        ai.IsEnable = false;

        //combineaiStateControllers.Remove(ai);
    }
Exemplo n.º 2
0
    public void CreatCombineEnemyRole(CombineEnemyAIStateController ai, string msg, Vector3 P, Quaternion Q)
    {
        Debug.Log("StartCreatModel");
        ai.msg = msg;
        GameObject go = Resources.Load <GameObject>(msg);

        ai.Role = Instantiate(go, P, Q);
        ai.Role.GetComponent <PlayerHealth>().stateController = ai;//
        ai.Intialize(this);
        combineaiStateControllers.Add(ai);
    }
Exemplo n.º 3
0
    public void CheckCombine(CombineEnemyAIStateController m_ai)
    {
        m_ai.Checktimer += Time.deltaTime;
        if (m_ai.Checktimer > m_ai.checkInterval)
        {
            Debug.LogWarning("Check work success!!");
            if (m_ai.neighbors.Count != null)
            {
                m_ai.neighbors.Clear();
            }

            Debug.LogWarning("Add Neighbor!!");
            foreach (CombineEnemyAIStateController AI in combineaiStateControllers)
            {
                if (AI.IsEnable)
                {
                    if (Vector3.Distance(AI.Role.transform.position, m_ai.Role.transform.position) <= 50 && AI != m_ai && !AI.IsGroup)
                    {
                        m_ai.neighbors.Add(AI);
                    }
                }
            }
            if (m_ai.neighbors.Count > 4)
            {
                Debug.LogWarning("Neighbor is amount 4!!");
                m_ai.IsGroup   = true;
                m_ai.m_aiState = CombineEnemyAIStateController.CombineEnemyState.Wait;
                for (int i = 0; i < 4; i++)
                {
                    m_ai.neighbors[i].IsGroup    = true;
                    m_ai.neighbors[i].originator = m_ai.Role;
                    m_ai.neighbors[i].m_aiState  = CombineEnemyAIStateController.CombineEnemyState.FindCombinePos;
                }
            }
            m_ai.Checktimer = 0;
        }
    }