private void OnConnection(IRemotePoint sender) { var netObj = Instantiate(prefab); sender.GameObject = netObj; objects.Add(sender.ConnectionID, netObj); }
public void Notify(MessageType type, NetworkReader reader, IRemotePoint sender) { if (handlers.ContainsKey(type)) { handlers[type](reader, sender); } }
private void OnMovementInput(NetworkReader reader, IRemotePoint sender) { var message = reader.ReadMessage <MovementInput>(); if (!objects.ContainsKey(sender.ConnectionID)) { return; } objects[sender.ConnectionID].transform.position += message.input * 10f * Time.deltaTime; }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IRemotePoint remotePointsCasted = item.As <IRemotePoint>(); if ((remotePointsCasted != null)) { this._parent.RemotePoints.Add(remotePointsCasted); } ICommunicationLink communicationLinksCasted = item.As <ICommunicationLink>(); if ((communicationLinksCasted != null)) { this._parent.CommunicationLinks.Add(communicationLinksCasted); } }
/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(IModelElement item) { IRemotePoint remotePointItem = item.As <IRemotePoint>(); if (((remotePointItem != null) && this._parent.RemotePoints.Remove(remotePointItem))) { return(true); } ICommunicationLink communicationLinkItem = item.As <ICommunicationLink>(); if (((communicationLinkItem != null) && this._parent.CommunicationLinks.Remove(communicationLinkItem))) { return(true); } return(false); }
private void OnConnection(NetworkReader reader, IRemotePoint sender) { entityService.Spawn(prefab); }
public void NotifyDisconnected(IRemotePoint sender) { Disconnected?.Invoke(sender); }
private void Handle_Hello(NetworkReader reader, IRemotePoint sender) { var x = reader.ReadMessage <Hello>(); print($"{sender.ConnectionID} sent {x.message}"); }