private void ReadMissionCommandExecute() { if (VehicleSelected != null) { MissionComponent.ReadMission(VehicleSelected.ID); } }
private void RestartMission() { if (VehicleSelected != null) { MissionComponent.RestartMission(VehicleSelected.ID, 0, 0); } }
public void StartMission() { if (VehicleSelected != null) { MissionComponent.StartMission(VehicleSelected.ID, 0); } }
private void ReadMissionCommandExecute() { //ServiceLocator.Current.GetInstance<IListWaypoint>().DeleteWaypointCommand.Execute(null); if (VehicleSelected != null) { MissionComponent.ReadMission(VehicleSelected.ID); } }
private bool StartMissionAsync() { if (VehicleSelected == null) { return(false); } MissionComponent.StartMissionAuto(VehicleSelected.ID, 0); return(true); }
public void onClick(InputAction.CallbackContext context) { if (context.started) { var startGame = dialogueScript.Submit(); if (startGame) { mission = GetComponent <MissionComponent>(); mission.StartMission(); } } }
private void MissionCommandsExecute(SoftkeyEnum obj) { if (VehicleSelected == null) { return; } switch (obj) { case SoftkeyEnum.ArmDisArm: var guiQuadVehicle = VehicleSelected as GuiQuadVehicle; VehicleComponent.SetArmDisArmCommand(VehicleSelected.ID, !guiQuadVehicle.QuadStatus.Armed); break; case SoftkeyEnum.Loiter: break; case SoftkeyEnum.ReturnToLaunch: break; case SoftkeyEnum.SetHome: break; case SoftkeyEnum.StartMission: MissionComponent.StartMission(VehicleSelected.ID, 0); break; case SoftkeyEnum.StopMission: MissionComponent.StopMission(VehicleSelected.ID, 0); break; case SoftkeyEnum.RestartMission: MissionComponent.RestartMission(VehicleSelected.ID, 0, 0); break; case SoftkeyEnum.Auto: break; case SoftkeyEnum.Sensor: break; case SoftkeyEnum.Reserve: break; case SoftkeyEnum.TaskOff: VehicleComponent.TakeOffCommand(VehicleSelected.ID, 100, (float)VehicleSelected.Latitude, (float)VehicleSelected.Longitude, (float)VehicleSelected.Heading); break; default: throw new ArgumentOutOfRangeException("obj"); } }
private void ShowAllMissions() { UIUtil.DestoryTransformChild(_missionRoot); foreach (var item in GameManager.AllMissions) { GameObject child = UIUtil.AppendChild(_missionRoot.gameObject, _missionPrefab); MissionComponent com = child.GetComponent <MissionComponent>(); com.DataContent = item; } RefreshList(); }
private async void SetNextWaypointCommandExecute() { await AsyncUtil.RaunAsync(() => { foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected)) { var next = vehicle.NextWaypoint + 1; MissionComponent.GoToCurrentWaypointId(vehicle.ID, 0, next); Thread.Sleep(1000); } return(true); }); }
void UpdateMission() { Debug.Log(missions.Count); switch (missions.Peek()) { case MissionType.Hits: missionScript = this.gameObject.AddComponent <Hits>(); break; case MissionType.Hoops: missionScript = this.gameObject.AddComponent <Hoops>(); break; } }
private void WriteMissionCommandExecute() { if (VehicleSelected != null && VehicleSelected.Tasks.Count > 0) { MissionComponent.UploadTask(VehicleSelected.ID, VehicleSelected.HomePosition, new MavlinkWaypoint { Latitude = VehicleSelected.Latitude, Longitude = VehicleSelected.Longitude, Altitude = DefaultAltitude, Param4 = (float)VehicleSelected.Heading }, VehicleSelected.Tasks[0]); } }
private async void MissionCommandsExecute(SoftkeyEnum obj) { await AsyncUtil.RaunAsync(() => { switch (obj) { case SoftkeyEnum.StartMission: { foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected)) { MissionComponent.StartMission(vehicle.ID, 0); Thread.Sleep(1000); Debug.WriteLine("StartMission - vehicle " + vehicle.ID); } } break; case SoftkeyEnum.StopMission: { foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected)) { MissionComponent.StopMission(vehicle.ID, 0); Thread.Sleep(1000); Debug.WriteLine("StopMission - vehicle " + vehicle.ID); } } break; case SoftkeyEnum.RestartMission: { foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected)) { MissionComponent.RestartMission(vehicle.ID, 0, 0); Thread.Sleep(1000); Debug.WriteLine("RestartMission - vehicle " + vehicle.ID); } } break; } return(obj); }); }
private void SelectTaskCommandExecute(object obj) { var vehicle = obj as Vehicle; if (vehicle != null) { vehicle.Tasks.Clear(); vehicle.Tasks.Add(vehicle.Task); vehicle.Task = vehicle.Task; vehicle.IsActivateMission = false; MissionComponent.UploadTask(vehicle.ID, vehicle.HomePosition, new MavlinkWaypoint { Latitude = vehicle.Latitude, Longitude = vehicle.Longitude, Altitude = DefaultAltitude, Param4 = (float)vehicle.Heading }, vehicle.Task); vehicle.MissionID = vehicle.Task.TaskID; } }
private void SelectedTaskCommandExecute(ITask obj) { foreach (var vehicle in VehiclesSource.Vehicles) { if (vehicle.ID == VehicleSelected.ID) { vehicle.Tasks.Clear(); vehicle.Tasks.Add(obj); vehicle.Task = obj; vehicle.IsActivateMission = false; MissionComponent.UploadTask(vehicle.ID, vehicle.HomePosition, new MavlinkWaypoint { Latitude = vehicle.Latitude, Longitude = vehicle.Longitude, Altitude = DefaultAltitude, Param4 = (float)VehicleSelected.Heading }, vehicle.Tasks[0]); vehicle.MissionID = VehicleSelected.Tasks[0].TaskID; } } }
private async void SendMissionCommandsExecute() { await AsyncUtil.RaunAsync(() => { foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected)) { if (vehicle.Task != null) { vehicle.IsActivateMission = false; MissionComponent.UploadTask(vehicle.ID, vehicle.HomePosition, new MavlinkWaypoint { Latitude = vehicle.Latitude, Longitude = vehicle.Longitude, Altitude = DefaultAltitude, Param4 = (float)vehicle.Heading }, vehicle.Task); } } return(true); }); }
void Start() { dialogueScript = GetComponent <DialogueScript>(); mission = GetComponent <MissionComponent>(); }
private void CommandStateClick(object obj) { if (VehicleComponent == null) { VehicleComponent = ServiceLocator.Current.GetInstance <IVehicleComponent>(); } if (VehicleComponent == null) { return; } if (MissionComponent == null) { MissionComponent = ServiceLocator.Current.GetInstance <IMissionComponent>(); } if (MissionComponent == null) { return; } VisibilityView = Visibility.Hidden; var state = obj as string; switch (state) { case "CameHome": if (VehicleSelected != null) { VehicleComponent.SendModeCommand(VehicleSelected.ID, (uint)VehicleModeEnum.RTL); } break; case "Land": if (VehicleSelected != null) { VehicleComponent.SendModeCommand(VehicleSelected.ID, (uint)VehicleModeEnum.Land); } break; case "Pause": if (VehicleSelected != null) { VehicleComponent.SendModeCommand(VehicleSelected.ID, (uint)VehicleModeEnum.Loiter); } break; case "Start": if (VehicleSelected != null) { //VehicleComponent.SendModeCommand(VehicleSelected.ID, (uint) VehicleModeEnum.Auto); //MissionComponent.StartMission(VehicleSelected.ID, 0); MissionComponent.StartMissionAuto(VehicleSelected.ID, 0); } break; case "LoadMission": if (VehicleSelected.Tasks.Count > 0) { VehicleSelected.IsActivateMission = false; MissionComponent.UploadTask(VehicleSelected.ID, VehicleSelected.HomePosition, new MavlinkWaypoint { Latitude = VehicleSelected.Latitude, Longitude = VehicleSelected.Longitude, Altitude = DefaultAltitude, Param4 = (float)VehicleSelected.Heading }, VehicleSelected.Tasks[0]); VehicleSelected.MissionID = VehicleSelected.Tasks[0].TaskID; } break; case "TakeOff": if (VehicleSelected != null) { VehicleComponent.TakeOffCommand(VehicleSelected.ID, 100, (float)VehicleSelected.Latitude, (float)VehicleSelected.Longitude, (float)VehicleSelected.Heading); } break; case "ControlRequest": //if (value) // ServiceLocator.Current.GetInstance<IJoystick>(idx).Start(); //else // ServiceLocator.Current.GetInstance<IJoystick>().Stop(); break; case "OpenCamera": if (QuadPropertyWindow != null) { QuadPropertyWindow.Close(); QuadPropertyWindow = null; } QuadPropertyWindow = new QuadPropertyWindow(); QuadPropertyWindow.Show(); break; } }
public void Start() { msComponent = transform.parent.gameObject.GetComponent <MissionComponent>(); }
private void MapMouseLeftButtonDownAction(MapMouseLeftButtonDownMessenger obj) { int DistanceDefault = 50; if (VehicleSelected == null) { return; } if (InsertHoverPoint) { //Target //var a = Utils.Utils.DegreeBearing(VehicleSelected.Latitude, VehicleSelected.Longitude, obj.Latitude,obj.Longitude); var convertPoint = new ObservableCollection <Waypoint>(); var x = VehicleSelected.Latitude; var y = VehicleSelected.Longitude; //Utils.Utils.ConvertMercatorToGeo(ref y, ref x); /*var bearing = Utils.Utils.DegreeBearing(VehicleSelected.Latitude, VehicleSelected.Longitude, obj.Latitude,obj.Longitude); * var distance = Utils.Utils.CalculateDistance(VehicleSelected.Latitude, VehicleSelected.Longitude, * obj.Latitude, obj.Longitude, "K") *1000; * if (distance > DistanceDefault) * { * Utils.Utils.PointRadialDistance(ref x, ref y, bearing, DistanceDefault); * }*/ convertPoint.Add(new MavlinkWaypoint { Latitude = x, Longitude = y, Altitude = DefaultAltitude, Id = 1, Param4 = (float)VehicleSelected.Heading, Command = (ushort)MissionMavCmd.WAYPOINT, }); convertPoint.Add(new MavlinkWaypoint { Latitude = obj.Latitude, Longitude = obj.Longitude, Altitude = DefaultAltitude, Id = 2, Command = (ushort)MissionMavCmd.WAYPOINT, }); var task = new MavlinkTaskNav("HoverTask", TaskID) { NavPath = convertPoint, TaskType = TaskTypeEnum.Hoverrer }; MissionSource.AddTask(task); VehicleSelected.Tasks.Clear(); VehicleSelected.Tasks.Add(task); var newShape = new Shape(TaskID, convertPoint) { Symbol = (LineSymbol)Application.Current.FindResource("LineSymbol") }; ServiceLocator.Current.GetInstance <IMap>().AddShape(newShape); //MissionComponent.UploadTask(VehicleSelected.ID, // VehicleSelected.HomePosition, // new MavlinkWaypoint // { // Latitude = VehicleSelected.Latitude, // Longitude = VehicleSelected.Longitude, // Altitude = DefaultAltitude, // Param4 = (float) VehicleSelected.Heading // }, // VehicleSelected.Tasks[0]); VehicleSelected.IsActivateMission = false; MissionComponent.UploadTask(VehicleSelected.ID, VehicleSelected.HomePosition, null, VehicleSelected.Tasks[0]); VehicleSelected.MissionID = VehicleSelected.Tasks[0].TaskID; } }
public void ChangeList() { // 미션 리스트 초기화 Transform[] childList = content.GetComponentsInChildren <Transform>(); if (childList != null) { for (int i = 1; i < childList.Length; i++) { if (childList[i] != transform) { Destroy(childList[i].gameObject); } } } dataManager.LoadMission(); string category = categoryLabel.text; foreach (Mission mission in dataManager.missionList) { if (mission.category == category) { GameObject rightMission = Instantiate(missionContent); MissionComponent msComponent = rightMission.GetComponent <MissionComponent>(); rightMission.GetComponentInChildren <CheckMission>().mission = mission; msComponent.msName.text = mission.name; msComponent.msPrice.text = mission.price + ""; // 카테고리 이미지 설정 switch (category) { case "여행": msComponent.msCategory.sprite = msComponent.travel; break; case "휴가": msComponent.msCategory.sprite = msComponent.vacation; break; case "운동": msComponent.msCategory.sprite = msComponent.sport; break; case "공부": msComponent.msCategory.sprite = msComponent.study; break; case "기타": msComponent.msCategory.sprite = msComponent.etc; break; default: break; } // 업적 달성 여부 표시 if (mission.success) { msComponent.msCheck.sprite = msComponent.success; } else { msComponent.msCheck.sprite = msComponent.fail; } rightMission.transform.parent = content.transform; rightMission.transform.localScale = missionContent.transform.localScale; rightMission.transform.localPosition = new Vector3(rightMission.transform.localPosition.x, rightMission.transform.localPosition.y, 0); rightMission.transform.localRotation = new Quaternion(0, 0, 0, 0); } } }