Esempio n. 1
0
    void RPC_SO_InitData(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        ItemAsset.ItemObject itemObj = stream.Read <ItemAsset.ItemObject>();
        _pos = transform.position = stream.Read <Vector3>();
        rot  = transform.rotation = stream.Read <Quaternion>();

        if (null == itemObj)
        {
            return;
        }

        ItemAsset.Drag drag = itemObj.GetCmpt <ItemAsset.Drag>();
        if (null == drag)
        {
            return;
        }

        DragArticleAgent item = DragArticleAgent.Create(drag, _pos, transform.localScale, rot, Id, this);

        if (item.itemLogic != null)
        {
            DragItemLogicFlag flag = item.itemLogic as DragItemLogicFlag;
            if (flag != null)
            {
                OnSpawned(flag.gameObject);

                Pathea.PeEntity FlagEntity = flag.gameObject.GetComponent <Pathea.PeEntity>();
                if (null != FlagEntity)
                {
                    Pathea.NetCmpt net = FlagEntity.GetCmpt <Pathea.NetCmpt>();
                    if (null == net)
                    {
                        net = FlagEntity.Add <Pathea.NetCmpt>();
                    }

                    net.network = this;
                }
            }
        }

        OnResetFlag();
    }