Exemplo n.º 1
0
    public bool Equip_InsertEquipItem(EAObjID _id, uint slot, EA_CItemUnit pitem)
    {
        EA_CCharBPlayer pActor = EACObjManager.instance.GetActor(_id);

        if (pActor == null)
        {
            return(false);
        }

        if (pActor.GetObjInfo().m_eObjType == eObjectType.CT_MYPLAYER)
        {
            EA_Equipment pEquipment = m_myPlItemManager.GetEquip();

            if (pEquipment != null)
            {
                pEquipment.InsertEquipItem(slot, pitem);
            }
        }
        else
        {
            EA_Equipment pEquipment = m_PCItemManager.Get_PCEquipItem(_id);

            if (pEquipment == null)
            {
                pEquipment = new EA_Equipment();
                m_PCItemManager.InsertPCEquip(_id, pEquipment);
            }

            //  [4/10/2014 puos] Equipped with items
            pEquipment.InsertEquipItem(slot, pitem);
        }

        return(true);
    }
Exemplo n.º 2
0
    public EA_CCharBPlayer GetActor(EAObjID _id)
    {
        EA_CCharBPlayer pActor = null;

        pActor = (pActor == null) ? GetPlayer(_id) : pActor;
        pActor = (pActor == null) ? GetMob(_id) : pActor;
        pActor = (pActor == null) ? GetNPC(_id) : pActor;

        return(pActor);
    }
Exemplo n.º 3
0
    public bool Equip_RemoveEquip(EAObjID _id)
    {
        EA_CCharBPlayer pActor = EACObjManager.instance.GetActor(_id);

        if (pActor != null)
        {
            if (pActor.GetObjInfo().m_eObjType != eObjectType.CT_MYPLAYER)
            {
                m_PCItemManager.RemovePCEquip(_id);
            }

            return(true);
        }

        return(false);
    }
Exemplo n.º 4
0
    public EAActor GetOwnerActor()
    {
        if (GetItemBase() != null)
        {
            EAObjID _objID = GetItemBase().GetItemInfo().m_HavenUser;

            EA_CCharBPlayer pActor = (EA_CCharBPlayer)EACObjManager.instance.GetActor(_objID);

            if (pActor != null && pActor.GetLinkIActor() != null)
            {
                return(pActor.GetLinkIActor());
            }
        }

        return(null);
    }
Exemplo n.º 5
0
    EAObjID SetActorItem(EA_CCharBPlayer pUser, EA_CItemUnit pItemUnit)
    {
        if (pUser == null || pItemUnit == null)
        {
            return(CObjGlobal.InvalidObjID);
        }

        EAObjID objID = CObjGlobal.InvalidObjID;

        ObjectInfo ObjInfo = new ObjectInfo();

        ObjInfo.m_ModelTypeIndex = pItemUnit.GetItemBaseInfo().m_ModelTypeIndex;
        ObjInfo.m_objClassType   = pItemUnit.GetItemBaseInfo().m_objClassType;

        ItemObjInfo itemInfo = new ItemObjInfo();

        itemInfo.m_HavenUser  = pUser.GetObjID();
        itemInfo.m_iItemIndex = pItemUnit.GetItemId(); //  [4/7/2014 puos] The item ID of the item object

        if (pItemUnit.GetItemBaseInfo().m_eItemType == eItemType.eIT_Weapon)
        {
            itemInfo.m_eItemType = eItemObjType.IK_WEAPON;

            //  [3/21/2018 puos] If there is an item object created in the current slot, it is not created.
            //  Fixed bug that was created even with created item object

            EA_CItem pItem = EACObjManager.instance.GetItemObject(pItemUnit.GetItemBaseInfo().m_GDObjId);

            if (pItem == null)
            {
                pItem = EACObjManager.instance.CreateItem(ObjInfo, itemInfo);
            }

            if (pItem != null)
            {
                pUser.SetWeaponAttachment(pItemUnit.GetAttackWeaponInfo().weaponType, pItem.GetLinkEntity());
                return(pItem.GetObjID());
            }
        }


        return(objID);
    }
Exemplo n.º 6
0
    /*! Mount item in equipment slot */
    public bool EquipmentItem(EAObjID _id, uint equip_slot)
    {
        EA_CCharBPlayer pUser = EACObjManager.instance.GetActor(_id);

        EA_Equipment pEquipment = null;

        if (pUser.GetObjInfo().m_eObjType == eObjectType.CT_MYPLAYER)
        {
            pEquipment = m_myPlItemManager.GetEquip();
        }
        else
        {
            pEquipment = m_PCItemManager.Get_PCEquipItem(_id);
        }

        pEquipment.EquipItem(pUser, equip_slot);

        return(true);
    }
Exemplo n.º 7
0
    public EA_Equipment Equip_FindEqipment(EAObjID _id)
    {
        EA_CCharBPlayer pActor = EACObjManager.instance.GetActor(_id);

        EA_Equipment pEquipment = null;

        if (pActor != null)
        {
            if (pActor.GetObjInfo().m_eObjType == eObjectType.CT_MYPLAYER)
            {
                pEquipment = m_myPlItemManager.GetEquip();
            }
            else
            {
                pEquipment = m_PCItemManager.Get_PCEquipItem(_id);
            }
        }

        return(pEquipment);
    }
Exemplo n.º 8
0
    public void EquipItem(EA_CCharBPlayer pUser, uint equip_slot)
    {
        EA_CItemUnit pItemUnit = FindEquipItembySlot(equip_slot);

        if (pItemUnit != null)
        {
            if (pItemUnit.GetItemBaseInfo().m_eItemType == eItemType.eIT_Weapon)
            {
                EAObjID objId = SetActorItem(pUser, pItemUnit);

                pItemUnit.GetItemBaseInfo().m_GDObjId = objId;
                m_nCurrEquipSlot = equip_slot;
                pUser.DoSwitchWeapons((uint)pItemUnit.GetAttackWeaponInfo().weaponType);
            }
        }
        else // 무기가 없을시에도 장착을 시도해야함
        {
            m_nCurrEquipSlot = equip_slot;
            pUser.DoSwitchWeapons(0);
        }
    }
Exemplo n.º 9
0
    public void FireShoot()
    {
        EAActor pActor = GetOwnerActor();

        Debug.Assert(pActor != null, "FireShoot Actor is null");

        if (fireDummyObject != null && pActor != null)
        {
            ObjectInfo ObjInfo = new ObjectInfo();

            ObjInfo.spawnPos[0] = fireDummyObject.transform.position.x;
            ObjInfo.spawnPos[1] = fireDummyObject.transform.position.y;
            ObjInfo.spawnPos[2] = fireDummyObject.transform.position.z;

            ObjInfo.spawnAngle[0] = fireDummyObject.transform.rotation.eulerAngles.x;
            ObjInfo.spawnAngle[1] = fireDummyObject.transform.rotation.eulerAngles.y;
            ObjInfo.spawnAngle[2] = fireDummyObject.transform.rotation.eulerAngles.z;

            ObjInfo.m_ModelTypeIndex = WeaponInfo.uProjectileModelType;
            ObjInfo.m_objClassType   = WeaponInfo.m_objProjectileClassType;
            ObjInfo.SetObjName("projectile");

            ItemObjInfo itemInfo = new ItemObjInfo();

            EA_CCharBPlayer pCharBase = pActor.GetCharBase();

            if (pCharBase != null)
            {
                itemInfo.m_HavenUser = pCharBase.GetObjID();
            }

            if (ObjInfo.m_objClassType == default(Type))
            {
                ObjInfo.m_objClassType = typeof(EAProjectile);
            }

            itemInfo.m_eItemType = eItemObjType.IK_Projectile;
            EA_CItem pItem = EACObjManager.instance.CreateItem(ObjInfo, itemInfo);

            // Create if no bullet. Do not use pool
            if (pItem.GetLinkEntity() == null)
            {
                GameObject pGameObject = new GameObject("projectile", ObjInfo.m_objClassType);

                pGameObject.transform.position    = new Vector3(ObjInfo.spawnPos[0], ObjInfo.spawnPos[1], ObjInfo.spawnPos[2]);
                pGameObject.transform.eulerAngles = new Vector3(ObjInfo.spawnAngle[0], ObjInfo.spawnAngle[1], ObjInfo.spawnAngle[2]);

                pItem.SetLinkEntity(pGameObject);
                pItem.SetLinkItem(pGameObject.GetComponent <EAProjectile>());
            }

            GameObject   item        = pItem.GetLinkEntity();
            EAProjectile pProjectile = null;

            if (item != null)
            {
                pProjectile = item.GetComponent <EAProjectile>();
            }

            if (pProjectile != null)
            {
                if (ProjectileTransform.instance != null)
                {
                    pProjectile.transform.SetParent(ProjectileTransform.instance.transform);
                }

                // use sphereCollider
                Collider c = pProjectile.GetComponent <Collider>();

                if (c == null)
                {
                    SphereCollider sc = pProjectile.gameObject.AddComponent <SphereCollider>();
                    sc.radius = WeaponInfo.projectileRadius;
                }

                pProjectile.SetProjectileDir(fireDummyObject.transform.forward);

                pProjectile.SetOwnActor(itemInfo.m_HavenUser);

                pProjectile.SetWeapon(GetItemBase().GetObjID());

                pProjectile.SetWeaponInfo(WeaponInfo);

                Debug.Log("fire shoot - weapon user id :" + itemInfo.m_HavenUser + " projectile type : " + WeaponInfo.projectileType);
            }

            pItem.Use();
        }
    }
Exemplo n.º 10
0
    /// <summary>
    ///
    /// </summary>
    protected void FindWeapon()
    {
        EA_CCharBPlayer pActor = GetCharBase();

        EA_Equipment pEquipment = null;

        //2017 1126 Consider even without weapons
        m_pCurWeapon = null;

        if (pActor != null)
        {
            pEquipment = EA_ItemManager.instance.Equip_FindEqipment(pActor.GetObjID());
        }

        if (pEquipment != null)
        {
            EA_CItemUnit pItemUnit = pEquipment.GetCurrentItem();

            if (pItemUnit != null)
            {
                EA_CItem pItem = EACObjManager.instance.GetItemObject(pItemUnit.GetObjId());

                if (pItem != null)
                {
                    Debug.Assert(pItem.GetLinkItem() != null, "EAActor FindWeapon pItem.GetLinkItem() is null");

                    if (pItem.GetLinkItem() != null)
                    {
                        m_pCurWeapon = (EAWeapon)pItem.GetLinkItem() as EAWeapon;
                    }
                }
            }
        }

        //  [5/28/2018 puos] bug fixed
        if (m_pCurWeapon == null)
        {
            if (pActor != null)
            {
                pEquipment = EA_ItemManager.instance.Equip_FindEqipment(pActor.GetObjID());
            }

            if (pEquipment != null)
            {
                EA_CItemUnit pItemUnit = pEquipment.GetCurrentItem();

                if (pItemUnit != null)
                {
                    EA_CItem pItem = EACObjManager.instance.GetItemObject(pItemUnit.GetObjId());

                    if (pItem != null)
                    {
                        Debug.Assert(pItem.GetLinkItem() != null, "EAActor FindWeapon2 pItem.GetLinkItem() is null");

                        if (pItem.GetLinkItem() != null)
                        {
                            m_pCurWeapon = (EAWeapon)pItem.GetLinkItem() as EAWeapon;
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 11
0
 public void SetCharBase(EA_CCharBPlayer pDiaCharBase)
 {
     m_pDiaCharBase = pDiaCharBase;
 }