private void RPC_S2C_InitData(uLink.BitStream stream, uLink.NetworkMessageInfo info) { ItemAsset.ItemObject item = stream.Read <ItemAsset.ItemObject>(); _pos = transform.position = stream.Read <Vector3>(); rot = transform.rotation = stream.Read <Quaternion>(); HP = stream.Read <float>(); MaxHP = stream.Read <float>(); Fuel = stream.Read <float>(); MaxFuel = stream.Read <float>(); authId = stream.Read <int>(); _ownerId = stream.Read <int>(); if (null == item) { Debug.LogWarning("CreationNetwork RPC_S2C_InitData null item."); return; } DragArticleAgent agent = DragArticleAgent.Create(DragArticleAgent.CreateItemDrag(item.protoId), _pos, Vector3.one, rot, _id, this, true); if (agent != null && null != agent.itemLogic && null != agent.itemLogic.gameObject) { OnSpawned(agent.itemLogic.gameObject); _entity = agent.itemLogic.gameObject.GetComponent <WhiteCat.CreationSkEntity>(); if (_entity != null) { NetCmpt net = _entity.GetComponent <NetCmpt>(); if (null == net) { net = _entity.gameObject.AddComponent <NetCmpt>(); } net.network = this; } } else { Debug.LogWarningFormat("CreationNetwork RPC_S2C_InitData invalide agent:{0}", item.protoId); } OnSkAttrInitEvent += SendBaseAttr; StartCoroutine(SyncMove()); }
protected override void RPC_S2C_SetController(uLink.BitStream stream, uLink.NetworkMessageInfo info) { authId = stream.Read <int>(); _teamId = stream.Read <int>(); ResetContorller(); SendBaseAttr(); if (_entity == null) { return; } var robot = _entity.GetComponent <WhiteCat.AIBehaviourController>(); if (robot) { robot.SetCreater(_ownerId); } //#if UNITY_EDITOR // PlayerNetwork p = PlayerNetwork.GetPlayer(authId); // if (null != p) // Debug.LogFormat("<color=blue>{0} got [{1}]'s authority.</color>", p.RoleName, Id); //#endif }