Пример #1
0
    public IEnumerator StartAI()
    {
        if (m_Unit.GetAct() != E_ACT.DIE)
        {
            yield return(new WaitForSeconds(0.5f));

            MoveUnit();
            yield return(new WaitForSeconds(0.5f));

            if (m_Unit.GetAct() == E_ACT.ATK)
            {
                yield return(new WaitForSeconds(0.8f));

                if (m_Unit.GetAct() == E_ACT.COUNTERHIT)
                {
                    m_Unit.GetAnim().speed = 0.0f;
                    yield return(new WaitForSeconds(3.0f));
                }
                m_Unit.GetAnim().speed = 1.0f;
                GameObject obj         = ObjectPool.GetInst().GetObject(m_Unit.GetAttackBase().objType);
                obj.SetActive(false);
                yield return(new WaitForSeconds(0.2f));

                if (m_Unit.gameObject.activeSelf)
                {
                    obj.GetComponent <AtkElement> ().SetUnit(m_Unit);
                    obj.GetComponent <AtkElement> ().SetValue(m_Unit.GetAttackBase().nDmg);
                    obj.SetActive(true);
                    m_Unit.GetAnim().SetInteger("CurAnim", (int)E_ACT.IDLE);
                }
                yield return(new WaitForSeconds(2.0f));
            }
            m_Unit.SetAct(E_ACT.IDLE);
            UnitMgr.Inst.TurnOver();
            yield return(null);
        }
        yield return(null);
    }