Example #1
0
 //
 void Start()
 {
     for (int iLoop = 0; iLoop < m_lstRoundMonsterInfo.Count; ++iLoop)
     {
         RoundMonsterInfo data = m_lstRoundMonsterInfo[iLoop];
         data.m_MonsterObj.GetComponent <CharacterController>().detectCollisions = false;
     }
 }
Example #2
0
    void Update()
    {
        if (null == m_lstRoundMonsterInfo || 0 == m_lstRoundMonsterInfo.Count)
        {
            return;
        }
        for (int iLoop = 0; iLoop < m_lstRoundMonsterInfo.Count; ++iLoop)
        {
            RoundMonsterInfo data = m_lstRoundMonsterInfo[iLoop];
            if (null == data)
            {
                continue;
            }
            if (null == data.m_path)
            {
                continue;
            }

            if (data.m_PathCount >= data.m_path.Length)
            {
                data.m_PathCount = 0;
            }

            if (bStand() && Time.realtimeSinceStartup - m_fStandTime >= m_fStandLimitTime)
            {
                m_fStandTime = Time.realtimeSinceStartup;
                m_bStanding  = true;
                PlayMonsterAction(data.m_MonsterObj, data.m_actStandName, data.m_actStandState);
            }

            if (m_bStanding && Time.realtimeSinceStartup - m_fStandTime >= m_fStandLimitTime)
            {
                m_bStanding  = false;
                m_fStandTime = 0f;
                PlayMonsterAction(data.m_MonsterObj, data.m_actRunName, data.m_actRunState);
            }

            if (m_bStanding)
            {
                return;
            }

            if (!data.m_bOpeationing)
            {
                for ( ; data.m_PathCount < data.m_path.Length;)
                {
                    data.m_curPath      = data.m_path[data.m_PathCount];
                    data.m_bOpeationing = true;
                    ++data.m_PathCount;
                    PlayMonsterAction(data.m_MonsterObj, data.m_actRunName, data.m_actRunState);
                    break;
                }
            }


            MoveTo(data.m_MonsterObj, data.m_curPath, data.m_actRunName, data.m_actStandState);

            if (Vector3.Distance(data.m_MonsterObj.transform.position, data.m_curPath.transform.position) < 0.3)
            {
                data.m_bOpeationing = false;
                PlayMonsterAction(data.m_MonsterObj, data.m_actStandName, data.m_actStandState);
            }
        }
    }