Ejemplo n.º 1
0
    public IEnumerator DelayRemoveFromNetwork(Net_Register_GameObject nRO)
    {
        //should stillbe negative to allow update to work and send clientRefresh the proper negative ID
        yield return(new WaitForSeconds(1.5f));

        entityContainers_InNetwork_OutputList.Remove(nRO);
        //nRO.entity_data.entityID = Mathf.Abs(nRO.entity_data.entityID);
    }
Ejemplo n.º 2
0
 public void RemoveFromInNetworkUpdateList(Net_Register_GameObject nRO)
 {
     //untrigger despawn -> allow to update to remove
     if (entityContainers_InNetwork_OutputList.Contains(nRO))
     {
         //trigger despawn
         //nRO.entity_data.entityID *= -1;
         StartCoroutine(DelayRemoveFromNetwork(nRO));
     }
 }
    public void On_Select_Asset_Refence_Button(int index, Button button)
    {
        GameObject currentObj = default;
        Net_Register_GameObject netRegisterComponent = default;

        try
        {
            currentObj           = allNetWork_GO_upload_list[index];
            netRegisterComponent = currentObj.GetComponent <Net_Register_GameObject>();//GetComponentInChildren<Net_Register_GameObject>(true);
        }
        catch
        {
            return;
        }
        if (!allNetWork_GO_upload_list[index].activeInHierarchy)
        {
            var colors = button.colors;
            colors.normalColor      = Color.green;
            colors.highlightedColor = Color.green + Color.black * 0.5f;
            button.colors           = colors;

            EventSystem.current.SetSelectedGameObject(button.gameObject);


            NetworkUpdateHandler.Instance.InteractionUpdate(new Interact
            {
                sourceEntity_id = _mainClient_entityData.entityID,
                targetEntity_id = index,//netRegisterComponent.positionWithin_urlList,
                interactionType = (int)INTERACTIONS.RENDERING,
            });
            //#endif
            currentObj.SetActive(true);
            MainClientUpdater.Instance.PlaceInNetworkUpdateList(netRegisterComponent);
        }
        else
        {
            var colors = button.colors;
            colors.normalColor      = Color.white;
            colors.highlightedColor = Color.white + Color.black * 0.5f;
            button.colors           = colors;

            button.OnSelect(new BaseEventData(EventSystem.current));

            currentObj.SetActive(false);
            MainClientUpdater.Instance.RemoveFromInNetworkUpdateList(netRegisterComponent);

            NetworkUpdateHandler.Instance.InteractionUpdate(new Interact
            {
                sourceEntity_id = _mainClient_entityData.entityID,
                targetEntity_id = index,
                interactionType = (int)INTERACTIONS.NOT_RENDERING,
            });
        }
    }
Ejemplo n.º 4
0
    public void Send_GameObject_UpdatesToNetwork(Net_Register_GameObject eContainer)
    {
        Coords coords = new Coords
        {
            clientId   = this.clientID,                        //(int) eContainer.entity_data.clientID,
            entityId   = (int)eContainer.entity_data.entityID, //((int)eContainer.entity_data.clientID * 10) + (int)eContainer.entity_data.current_Entity_Type,
            entityType = (int)eContainer.entity_data.current_Entity_Type,
            rot        = eContainer.transform.rotation,
            pos        = eContainer.transform.position,
        };

        coordExport.Invoke(coords);
    }
    public int RegisterNetWorkObject(int entityID, Net_Register_GameObject nRG)
    {
        //numbers over urls are gameobjects in scene to be modified
        _EntityID_to_urlListIndex.Add(entityID, nRG.positionWithin_urlList);
        _urlListIndex_to_EntityID.Add(nRG.positionWithin_urlList, entityID);
        _EntityID_To_NetObject.Add(entityID, nRG);
        // Debug.Log(entityID);
        allNetWork_GO_upload_list.Add(nRG.gameObject);

        //if (isActiveFromStart == false)
        //    nRG.gameObject.SetActive(false);

        return(_EntityID_To_NetObject.Count);
    }
    public void LinkNewNetworkObject(GameObject nGO, int index)
    {
        Net_Register_GameObject tempNet = nGO.AddComponent <Net_Register_GameObject>();

        tempNet.Instantiate(index);
    }
Ejemplo n.º 7
0
 public void RemoveALLInNetworkUpdateList(Net_Register_GameObject nRO)
 {
     entityContainers_InNetwork_OutputList.Clear();
 }
Ejemplo n.º 8
0
 public void PlaceInNetworkUpdateList(Net_Register_GameObject nRO)
 {
     entityContainers_InNetwork_OutputList.Add(nRO);
 }