public NetPlayerComponent(AOSClient client)
            : base(client)
        {
            netPlayers = new Dictionary <ushort, NetworkPlayer>();

            channel           = client.GetChannel(AOSChannelType.NetInterface);
            snapshotComponent = client.GetComponent <SnapshotNetComponent>();

            channel.AddRemoteEvent("Client_AddNetPlayer", R_AddNetPlayer);
            channel.AddRemoteEvent("Client_RemoveNetPlayer", R_RemoveNetPlayer);
            channel.AddRemoteEvent("Client_AddInitialNetPlayers", R_AddInitialNetPlayers);
        }
Ejemplo n.º 2
0
        public MPWorld(MasterRenderer renderer)
            : base(renderer)
        {
            players      = new Dictionary <ushort, ClientPlayer>();
            physEntities = new Dictionary <ushort, GameObject>();
            TimeOfDay    = 10;

            // Grab network components and the world channel
            client            = AOSClient.Instance;
            snapshotComponent = client.GetComponent <SnapshotNetComponent>();
            objectComponent   = client.GetComponent <ObjectNetComponent>();
            channel           = client.GetChannel(AOSChannelType.World);

            // Add remotes
            channel.AddRemoteEvent("Client_ThrowGrenade", R_ThrowGrenade);
            channel.AddRemoteEvent("Client_ShootMelon", R_ShootMelon);
            channel.AddRemoteEvent("Client_ServerImpact", R_ServerImpact);
            channel.AddRemoteEvent("Client_RolledBackServerPlayer", R_RolledBackServerPlayer);

            // Hook into component events
            objectComponent.OnCreatableInstantiated  += ObjectComponent_OnCreatableInstantiated;
            objectComponent.OnCreatableDestroyed     += ObjectComponent_OnCreatableDestroyed;
            snapshotComponent.OnWorldSnapshotInbound += SnapshotComponent_OnWorldSnapshotInbound;
        }