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 NewClient(Message msg) { var clientNetId = ((IntData)msg.Data).Value; var characterNetId = GetComponent <Data.AimTargetData>().CharacterNetId; var replicantNetId = Channel.ChannelIds[SubscribeType.Network]; if (characterNetId == clientNetId) { return; } MessageBus.SendMessage(NetAddressedMessage.Get(Network.API.Messages.CREATE_AIM_TARGET_REPLICANT, QosType.Reliable, clientNetId, API.InstanceData.GetData("Replicant", replicantNetId, GetComponent <Data.AimTargetData>().CharacterNetId))); }
private void NeedArmPosition(Message msg) { var data = (Weapons.API.WeaponInstantiateData)(msg.Data).GetCopy(); data.Parent = RightArm; data.ChannelId = Channel.ChannelIds[SubscribeType.Channel]; MessageBus.SendMessage(CommonMessage.Get(Weapons.API.Messages.INSTANTIATE, data)); int connectionId = ((ClientMessage)msg).ClientConnectionId; int netId = Network.Server.GetNetId(connectionId); if (!data.CreateAimTarget) { return; } MessageBus.SendMessage(SubscribeType.Channel, Channel.ChannelIds[SubscribeType.Channel], CommonMessage.Get(AimTarget.API.Messages.DESTROY)); MessageBus.SendMessage(NetAddressedMessage.Get(Network.API.Messages.CREATE_AIM_TARGET, QosType.Reliable, Channel.ChannelIds[SubscribeType.Network], AimTarget.API.InstanceData.GetData("ARAimTarget", netId, Channel.ChannelIds[SubscribeType.Network]))); }