コード例 #1
0
ファイル: EA_CMapObject.cs プロジェクト: puos/EAProjectV2
 public void SetLinkMapObject(EAMapObject pMapObject)
 {
     if (m_pLinkMapObject != pMapObject && pMapObject != null)
     {
         m_pLinkMapObject = pMapObject;
         m_pLinkMapObject.SetMapBase(this);
     }
 }
コード例 #2
0
ファイル: EA_ObjectFactory.cs プロジェクト: puos/EAProjectV2
    public static bool EntitySetting(EA_CObjectBase pSetObject, ObjectInfo SetObjinfo)
    {
        if (null == pSetObject)
        {
            Debug.Log("EntitySetting pSetObject is null :" + SetObjinfo.m_strGameName);
            return(false);
        }

        if (eObjectState.CS_SETENTITY != SetObjinfo.m_eObjState)
        {
            return(false);
        }

        string poolType = SetObjinfo.m_ModelTypeIndex;

        GameObject pGameObject = CObjResourcePoolingManager.instance.Spwan(poolType);

        pSetObject.SetLinkEntity(pGameObject);

        if (pGameObject == null)
        {
            Debug.LogError("EntitySetting Game object is invalid. type : " + poolType + ", name : " + pSetObject.GetObjInfo().m_strGameName);
            return(false);
        }

        // Modify class creation logic [3/30/2018 puos]
        if (SetObjinfo.m_objClassType != default(Type))
        {
            if (pGameObject.GetComponent(SetObjinfo.m_objClassType) == null)
            {
                pGameObject.AddComponent(SetObjinfo.m_objClassType);
            }
        }

        //	Create around object table
        switch (SetObjinfo.m_eObjType)
        {
        case eObjectType.CT_NPC:
        case eObjectType.CT_MONSTER:
        case eObjectType.CT_PLAYER:
        case eObjectType.CT_MYPLAYER:
        {
            EAActor actor = pGameObject.GetComponent <EAActor>();

            if (actor == null)
            {
                actor = pGameObject.AddComponent <EAActor>();
                SetObjinfo.m_objClassType = typeof(EAActor);
            }

            ((EA_CCharBPlayer)pSetObject).SetLinkActor(actor);
        }
        break;

        case eObjectType.CT_MAPOBJECT:
        {
            EAMapObject mapObject = pGameObject.GetComponent <EAMapObject>();

            if (mapObject == null)
            {
                mapObject = pGameObject.AddComponent <EAMapObject>();
                SetObjinfo.m_objClassType = typeof(EAMapObject);
            }

            ((EA_CMapObject)pSetObject).SetLinkMapObject(mapObject);
        }
        break;

        case eObjectType.CT_ITEMOBJECT:
        {
            EAItem itemObject = pGameObject.GetComponent <EAItem>();

            if (itemObject == null)
            {
                itemObject = pGameObject.AddComponent <EAItem>();
                SetObjinfo.m_objClassType = typeof(EAItem);
            }

            ((EA_CItem)pSetObject).SetLinkItem(itemObject);
        }
        break;
        }

        //Debug.Log("EntitySetting pSetObject :" + SetObjinfo.m_ModelTypeIndex);

        return(true);
    }