private void WalkOnChild(Transform transform) { foreach (Transform t in transform) { GameObject go = t.gameObject; kinematics = GetComponentOrDefault(go, kinematics); RobotLidar = GetComponentOrDefault(go, RobotLidar); manualController = GetComponentOrDefault(go, manualController); RobotCamera = GetComponentOrDefault(go, RobotCamera, "Camera", false); FirstPersonCamera = GetGameObjectOrDefault(go, FirstPersonCamera, "FirstPersonCamera"); ThirdPersonCamera = GetGameObjectOrDefault(go, ThirdPersonCamera, "ThirdPersonCamera"); TopCamera = GetGameObjectOrDefault(go, TopCamera, "TopCamera"); WalkOnChild(t); } }
void Start() { if (kinematics == null) { kinematics = GetComponent <DifferentialKinematics>(); } if (WorldCameraSelector == null) { WorldCameraSelector = GetComponent <CameraSelector>(); } if (RobotCamera == null) { RobotCamera = Camera.main; } if (RobotLidar == null) { RobotLidar = GetComponent <Lidar>(); } receiveBytes = new byte[921600]; Connected = false; ClientName = ""; GetCameraImage(); IPAddress ipAddress = IPAddress.Parse("127.0.0.1"); tcpServer = new TcpListener(ipAddress, Port); tcpServer.Server.SendTimeout = 1000; tcpServer.Server.ReceiveTimeout = 1000; tcpServer.Start(); running = true; thread = new Thread(new ThreadStart(ServerThread)); thread.Start(); }