void CreatMonster()
    {
        if (IsStay)
        {
            //Instantiate(Monsters[currentMonster].gameObject);
            counttimer += Time.deltaTime;
            if (counttimer > waittime)
            {
                waittime  -= 1;
                counttimer = 0;
                stopcreat  = false;
            }

            if (currentMonster < totalMonster && !stopcreat && counttimer > (waittime - 0.5f))
            {
                stopcreat = true;
                Monsters[currentMonster].transform.position = C_Pos.position;
                monster = Instantiate(Monsters[currentMonster].gameObject);
                Debug.LogWarning("Creat Monster Role Need Use AIGameManger");
                aI           = monster.GetComponent <EnemyAIStateController>();
                aI.theTarget = m_player;
                aI.m_aiState = EnemyAIStateController.EnemyAIState.ATTACK;
                currentMonster++;
            }
        }
    }
Example #2
0
 public void ReleaseEnemyAI(EnemyAIStateController ai, float t)
 {
     ai.StopListen();
     Destroy(ai.targetPos.gameObject);
     Destroy(ai.Role.gameObject, t);
     ai.IsEnable = false;
     //enemyaiStateControllers.Remove(ai);
 }
Example #3
0
    public void AutoCreatEnemyRole(EnemyAIStateController ai, string msg, Vector3 P, Quaternion Q)
    {
        //Debug.Log("StartCreatModel");
        ai.msg = msg;
        //Debug.Log(msg);
        GameObject go = Resources.Load <GameObject>(msg);

        ai.Role = Instantiate(go, P, Q);

        ai.Role.GetComponent <PlayerHealth>().stateController = ai;//
        ai.DefendIntialize(this);
        enemyaiStateControllers.Add(ai);
        //Debug.Log("Finish");
    }
Example #4
0
 public void SummonEnemyAIHelp(EnemyAIStateController ai, GameObject target, float radious)
 {
     foreach (EnemyAIStateController AI in enemyaiStateControllers)
     {
         if (AI.IsEnable)
         {
             if (Vector3.Distance(ai.RolePos, AI.RolePos) < radious && AI != ai && AI.m_aiState != EnemyAIStateController.EnemyAIState.ATTACK && AI.m_aiState != EnemyAIStateController.EnemyAIState.Chase)
             {
                 //Debug.Log("SummonPos" + ai.RolePos);
                 //Debug.Log("WalkerPos" + AI.RolePos);
                 //AI.SummonTarget = target;
                 AI.targetPos.transform.position = target.transform.position;
                 AI.m_aiState = EnemyAIStateController.EnemyAIState.WALK;
             }
         }
     }
 }