Beispiel #1
0
    public void Init(InstantiationData data, bool isMine)
    {
        Debug.LogWarning($"[PlayerCoreAdditive] Init isMine?{isMine}");
        this.parent = GetComponent <ITransmissionBase>() as TransmissionBase;

        if (isMine)
        {
            InitLocal();
        }
        else
        {
            InitRemote(data);
        }
    }
Beispiel #2
0
    public void Init(string uuid, Action onDestroyAct = null, TransmissionBase refToken = null)
    {
        Debug.Log($"PersistenceHelper Init");
        tokenID = uuid;

        if (onDestroyAct != null)
        {
            OnDestroyEvent += onDestroyAct;
        }

        if (refToken)
        {
            this.refToken = refToken;
        }
    }
Beispiel #3
0
    public void Init(InstantiationData data, bool isMine)
    {
        Debug.LogWarning("[RoomCoreAdditive] Init");
        this.parent = GetComponent <TransmissionBase>();

        if (!osa)
        {
            osa = GetComponent <OwnershipSubAdditive>();
        }

        osa.Init(data);

        //
        if (data.TryGetValue(InstantiationData.InstantiationKey.objectuuid, out object objUUID) &&
            data.TryGetValue(InstantiationData.InstantiationKey.objectname, out object objName))
        {
            var obj = ObjectSupplyManager.Instance.BuildObject((string)objName, (string)objUUID);
            if (obj == null)
            {
                Debug.LogError("[Init] Fail to BuildObject");
                return;
            }

            var go = obj as GameObject;
            parent.RefObject = go;
            go.transform.SetParent(ServiceManager.Instance.networkSystem.RoomObjectParent);

            // link between Token and TokenUser
            var tu = go.GetComponent <ISyncHandlerUser>();
            tu?.Init(data, false, parent);

            Debug.LogWarning("[Init] IOwnershipInteractable");
            var oi = go.GetComponent <IOwnershipInteractable>();
            oi.TargetObject = gameObject as object;
        }
    }