Esempio n. 1
0
    // Update is called once per frame
    protected void LateUpdate()
    {
        if (
            m_pEffectBaseInfo.m_EffectResourceType == eEffectResourceType.eDecal &&
            m_pEffectBaseInfo.m_bForceAxis == true
            )
        {
            EA_CObjectBase pObjectBase = EACObjManager.instance.GetGameObject(m_pEffectBaseInfo.m_AttachObjectId);

            if (pObjectBase != null && pObjectBase.GetLinkEntity() != null)
            {
                Vector3 position = Vector3.zero;

                position.x = pObjectBase.GetLinkEntity().transform.position.x;
                position.y = m_pEffectBaseInfo.m_fForceYpos;
                position.z = pObjectBase.GetLinkEntity().transform.position.z;

                transform.position = position;
            }
        }

        if (m_pSfx != null && m_bAutoDelete == true)
        {
            if (m_pSfx.IsAlive() == false)
            {
                if (m_pEffectBaseInfo.m_GDEffectId != CObjGlobal.InvalidEffectID)
                {
                    //Debug.Log("delete sfx :" + m_pEffectBaseInfo.m_GDEffectId );
                    EACEffectManager.instance.RemoveEffect(m_pEffectBaseInfo.m_GDEffectId);
                }
            }
        }
    }
Esempio n. 2
0
    public static bool EntityUnSetting(EA_CObjectBase pDelObjBase)
    {
        if (pDelObjBase != null)
        {
            if (pDelObjBase.GetObjInfo().m_eObjState == eObjectState.CS_SETENTITY)
            {
                //  [3/6/2014 puos] entity unsetting error check
                Debug.Log("EntityUnSetting error : " + pDelObjBase.GetObjInfo().m_strGameName);
                return(false);
            }

            GameObject pGameObject = pDelObjBase.GetLinkEntity();

            if (pGameObject == null)
            {
                Debug.Log("EntityUnSetting gameobject is null : " + pDelObjBase.GetObjInfo().m_strGameName);
                return(false);
            }

            // puos 20141019 null parent set
            pGameObject.transform.parent = null;

            CObjResourcePoolingManager.instance.Despawn(pDelObjBase.GetLinkEntity());

            pDelObjBase.SetLinkEntity(null);

            //Debug.Log("EntityUnSetting pSetObject :" + pDelObjBase.GetObjInfo().m_strGameName);
        }
        return(true);
    }
Esempio n. 3
0
    protected void GuidedProjectileType()
    {
        GameObject     pEntity     = null;
        EA_CObjectBase pObjectBase = null;

        if (!string.IsNullOrEmpty(WeaponInfo.m_strTargetActorBoneName))
        {
            pObjectBase = EACObjManager.instance.GetActor(WeaponInfo.m_TargetActorId);
        }
        else
        {
            pObjectBase = EACObjManager.instance.GetGameObject(WeaponInfo.m_TargetActorId);
        }

        if (pObjectBase != null && pObjectBase.GetLinkEntity())
        {
            pEntity = pObjectBase.GetLinkEntity();

            Collider c = pObjectBase.collider;

            Vector3 vColliderPos = Vector3.zero;

            if (c != null)
            {
                vColliderPos = c.bounds.extents;
            }

            Vector3 vTargetPos = (pEntity.gameObject.transform.position) + vColliderPos;

            Vector3 vDiff = vTargetPos - transform.position;

            m_vDir = vDiff;
            m_vDir.Normalize();
        }
        else
        {
            WeaponInfo.m_TargetActorId = CObjGlobal.InvalidObjID;
            m_vDir = m_vStartDir;
        }

        Debug.DrawLine(transform.position, transform.position + m_vDir * WeaponInfo.fProjectileSpeed * Time.deltaTime, Color.yellow);

        Vector3 vPos = transform.position + m_vDir * WeaponInfo.fProjectileSpeed * Time.deltaTime;

        SetVPos(vPos);
    }
Esempio n. 4
0
    public GameObject GetOwner()
    {
        if (GetItemBase() != null)
        {
            EAObjID _objID = GetItemBase().GetItemInfo().m_HavenUser;

            EA_CObjectBase pObjectBase = EACObjManager.instance.GetGameObject(_objID);

            if (pObjectBase != null)
            {
                return(pObjectBase.GetLinkEntity());
            }
        }

        return(null);
    }
Esempio n. 5
0
    public static bool EffectSetting(EA_CEffectNode pEffectNode, EA_EffectBaseInfo effectinfo)
    {
        if (null == pEffectNode)
        {
            Debug.Log("pEffectNode is null : " + effectinfo.m_GDEffectId);
            return(false);
        }


        if (eEffectState.ES_Load != effectinfo.m_eEffectState)
        {
            return(false);
        }

        //	Object basic information
        string sPoolType = effectinfo.m_EffectTableIndex;

        GameObject pGameObject = null;

        switch (effectinfo.m_eAttachType)
        {
        case eEffectAttachType.eWorld:
        {
            pGameObject = CEffectResourcePoolingManager.instance.Spwan(sPoolType);

            if (pGameObject != null)
            {
                pGameObject.transform.position = Vector3.zero;
            }
        }
        break;

        case eEffectAttachType.eLinkOffset:
        {
            EA_CObjectBase pObjectBase = EACObjManager.instance.GetGameObject(effectinfo.m_AttachObjectId);

            if (pObjectBase != null && pObjectBase.GetLinkEntity() != null)
            {
                GameObject IEntity = pObjectBase.GetLinkEntity();

                pGameObject = CEffectResourcePoolingManager.instance.Spwan(sPoolType);

                if (pGameObject != null)
                {
                    pGameObject.transform.parent = IEntity.transform;

                    pGameObject.transform.localPosition = Vector3.zero;
                    pGameObject.transform.localRotation = Quaternion.identity;
                }
            }
        }
        break;

        case eEffectAttachType.eLinkBone:
        {
            EA_CObjectBase pObjectBase = EACObjManager.instance.GetGameObject(effectinfo.m_AttachObjectId);

            if (pObjectBase != null)         //  [4/11/2014 puos]                        attach to the actor bone
            {
                GameObject pBone = pObjectBase.GetObjectInActor(effectinfo.m_AttachBoneName);

                if (pBone != null)
                {
                    pGameObject = CEffectResourcePoolingManager.instance.Spwan(sPoolType);

                    if (pGameObject != null)
                    {
                        pGameObject.transform.parent        = pBone.transform;
                        pGameObject.transform.localPosition = Vector3.zero;
                        pGameObject.transform.localRotation = Quaternion.identity;
                    }
                }
            }
        }
        break;
        }

        if (pGameObject == null)
        {
            Debug.Log("EffectSetting gameobject is null : " + effectinfo.m_GDEffectId);
            return(false);
        }

        if (pGameObject.GetComponent <EAEffectModule>() == null)
        {
            pGameObject.AddComponent <EAEffectModule>();
        }

        pEffectNode.SetLinkEffect(pGameObject.GetComponent <EAEffectModule>());

        return(true);
    }