Exemple #1
0
            public override void SendMethodInvoke(Entity entity, object[] arguments)
            {
                Syncronizer  syncronizer = entity.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                syncronizer.CreateMessage(MessageType.InvokeEntityMethod, delivery_method, delegate(Buffer buffer) {
                    buffer.WriteEntityReference(entity);
                    buffer.WriteEntityMethod(this);

                    WriteArguments(arguments, buffer);

                    if (actor.IsServer())
                    {
                        Invoke(entity.GetTarget(), arguments);
                    }
                }).Send();
            }
Exemple #2
0
            public void SendConstructorReplay(System system, NetworkRecipient recipient, object[] arguments, Entity spawned_entity)
            {
                Syncronizer  syncronizer = system.GetSyncronizer();
                NetworkActor actor       = syncronizer.GetNetworkActor();

                syncronizer.CreateMessage(MessageType.InvokeSystemMethod, NetDeliveryMethod.ReliableOrdered, delegate(Buffer buffer) {
                    buffer.WriteSystemReference(system);
                    buffer.WriteSystemMethod(this);

                    WriteArguments(arguments, buffer);

                    if (actor.IsServer())
                    {
                        buffer.WriteInt32(spawned_entity.GetId());
                        spawned_entity.WriteSync(buffer);
                    }
                }).Send(recipient);
            }