Exemple #1
0
        private bool SendCommand(int negotiation, int option)
        {
            byte[] sendData;

            sendData = TelnetHelper.GetCommand(negotiation, option);

            return(telnetClient.SendData(sendData));
        }
        internal void HandleRequest(TCPRequest request, byte[] dataReady)
        {
            byte[] data = new byte[dataReady.Length + DataIDs.PACKET_ID_COMPLEXITY];
            data[0] = request.PacketID;
            dataReady.CopyTo(data, DataIDs.PACKET_ID_COMPLEXITY);

            connection.SendData(DataIDs.RESPONSE_RECEPTION_ID, connection.myInfo.ID, data);
        }
Exemple #3
0
        public void SetupScene(int width, int height)
        {
            // create API key
            connection.SendData(Commands.GetSessions());
            AwaitResponse();

            //establish session
            connection.SendData(Commands.CreateTunnel(this.ApiKey));
            AwaitResponse();

            //reset scene
            ResetScene();
            AwaitResponse();

            //generate terrain
            AddTerrain(width, height);
            AwaitResponse();

            //add bicycle node
            AddBike("Bicycle");
            AwaitResponse();

            //connect camera to bike
            ConfigureCameraNode("Bicycle");
            AwaitResponse();
            Debug.WriteLine("- Connect camera to bicycle");

            //add main terrain node
            AddNode("TerrainNode");
            AwaitResponse();

            //shift terrain node to center
            MoveNode("TerrainNode", new int[] { -(int)(0.5 * width), -0, -(int)(0.5 * height) });
            AwaitResponse();


            //add texture to terrain
            AddTexture("desert_sand_big");
            AwaitResponse();

            //add road to terrain
            AddRoute();

            // Add bike data panel
            CreatePanel();
            AwaitResponse();
            ConnectNodeToNode("Panel", "Bicycle");

            //Let bicycle drive
            DriveRoute();
            //AwaitResponse();

            // Plant a tree
            //PlantTrees(20, width, height);
            //AwaitResponse();

            //Change bicycle speed to number
            ChangeSpeed(0);
            AwaitResponse();

#if DEBUG
            for (int i = 0; i < 14; i++)
            {
                chatMessages.Add($"Message {i}");
            }

            AddDataToPanel(new BikeDataPackage("0", "0", "0", "0", "0"));
#endif
            // print currently active nodes
            PrintNodes();
            donewithsetup = true;
        }