private void Start() { var netId = Channel.ChannelIds[SubscribeType.Network]; MessageBus.SendMessage(NetBroadcastMessage.Get(Network.API.Messages.CREATE_CHARACTER_REPLICANT, QosType.Reliable, netId, IntData.GetIntData(netId))); }
public IEnumerator StartAction() { yield return(new WaitForSeconds(2)); MessageBus.SendMessage(CommonMessage.Get(Network.API.Messages.CREATE_CHARACTER.ToString(), IntData.GetIntData(1))); MessageBus.SendMessage(CommonMessage.Get(Network.API.Messages.CREATE_AIM_TARGET.ToString(), AimTarget.API.InstanceData.GetData("UnarmedAimTarget", 2, 1))); }
private void NewClient(Message msg) { var clientNetId = ((IntData)msg.Data).Value; var replicantNetId = Channel.ChannelIds[SubscribeType.Network]; if (clientNetId == replicantNetId) { return; } MessageBus.SendMessage(NetAddressedMessage.Get(Network.API.Messages.CREATE_CHARACTER_REPLICANT, QosType.Reliable, clientNetId, IntData.GetIntData(replicantNetId))); }
private void ReadyForCharacter(int connectionId) { var netId = GetNetId(connectionId); MessageBus.SendMessage(NetAddressedMessage.Get(Messages.CREATE_CHARACTER, QosType.Reliable, netId, IntData.GetIntData(netId))); var aimTargetnetId = GetNetId(connectionId); MessageBus.SendMessage(NetAddressedMessage.Get(Messages.CREATE_AIM_TARGET, QosType.Reliable, aimTargetnetId, AimTarget.API.InstanceData.GetData("UnarmedAimTarget", aimTargetnetId, netId))); MessageBus.SendMessage(CommonMessage.Get(Messages.NEW_CLIENT, IntData.GetIntData(netId))); }
private void UpdateHp(Message msg) { Debug.Log("Update network hit points!"); _hitPoints = ((IntData)msg.Data).Value; var chan = GetComponent <Channel>(); MessageBus.SendMessage(SubscribeType.Channel, chan.ChannelIds[SubscribeType.Channel], CommonMessage.Get(Messages.UPDATE_HIT_POINTS, IntData.GetIntData(_hitPoints))); if (_hitPoints <= 0) { Destroy(gameObject); } }