Esempio n. 1
0
    public void doAnimEvent(string strParam)
    {
        float fDistance = m_pSkill.GetProto().fOPDist;
        float fRadious  = m_pSkill.GetProto().fOPRadius;

        if (m_pOwner != null)
        {
            GameObject[] EnemyList = GetFronEnemy(fDistance, fRadious);
            foreach (var Enemy in EnemyList)
            {
                if (Enemy.transform.tag == "Player")
                {
                    CPlayerCompent pAI = Enemy.GetComponent <CPlayerCompent>();
                    if (pAI != null)
                    {
                        m_pOwner.m_combat.CalculateDmg(pAI.m_pOwner, m_pSkill, strParam);
                    }
                }

                if (Enemy.transform.tag == "Monster")
                {
                    CtrolEnenyAI pAI = Enemy.GetComponent <CtrolEnenyAI>();
                    if (pAI != null)
                    {
                        m_pOwner.m_combat.CalculateDmg(pAI.m_pOwner, m_pSkill, strParam);
                    }
                }
            }
        }
    }
Esempio n. 2
0
    //-----------------------------------------------------------------------------------------
    /// <summary>
    /// ģ����Դ�첽�������
    /// </summary>
    //-----------------------------------------------------------------------------------------
    public override void OnAsyncLoaded()
    {
        if (gameObject != null)
        {
            CPlayerCompent pCompent = gameObject.AddComponent <CPlayerCompent>() as CPlayerCompent;
            if (pCompent != null)
            {
                pCompent.m_pOwner = this;
            }

            m_AnimCtrl    = gameObject.GetComponentInChildren <Animator>();
            m_CtrlSkelton = gameObject.GetComponent <CtrolAnimation>();
            m_FSM         = new CLocalPlayerFSM(this);
            if (isPlayer == false)
            {
                Common.calcPositionY(m_position, out m_position.y, false);
            }
            else
            {
                BoxCollider boxCollider = gameObject.GetComponent <BoxCollider>();
                if (boxCollider != null)
                {
                    UnityEngine.Object.Destroy(boxCollider);
                }
            }

            gameObject.SetActive(false);
            UnityEngine.GameObject.DontDestroyOnLoad(gameObject);
        }
    }
Esempio n. 3
0
    public void StartLookForEnemy( )
    {
        if (m_pProto.eType == ECreatureType.ECT_NPC)
        {
            return;
        }

        float fMaxDist = m_pProto.fLookdistance;

        GameObject[] EnemyList = GetFronEnemy(fMaxDist);


        CHeroEntity phero = null;

        foreach (var Enemy in EnemyList)
        {
            CPlayerCompent pAI = Enemy.GetComponent <CPlayerCompent>();
            if (pAI.m_pOwner == null)
            {
                continue;
            }

            if (pAI.m_pOwner.IsDead())
            {
                continue;
            }

            if (pAI.m_pOwner.IsInState(EState.ES_Lurk))
            {
                continue;
            }

            float fDis = (m_GameObject.transform.position - Enemy.transform.position).magnitude;
            if (fDis < fMaxDist)
            {
                phero    = pAI.m_pOwner;
                fMaxDist = fDis;
            }
        }

        if (phero != null)
        {
            m_pTarget = phero;
        }

        ReSetLookForTargetTime();
    }