public IEnumerator Fix() { status = FenceStatus.Fixed; _repairPopUpGameObject.SetActive(false); yield return(new WaitForSeconds(_particleDuration)); _health.RestoreHealth(); _health.UpdateHealthBar(); _healthBarGameObject.SetActive(false); Destroy(_currentlyPlayingPFX); //TODO: this is here because I am disabling the all box colliders in InteractiveObjectController GetComponent <BoxCollider>().enabled = true; }
private void Start() { _healthBarSlider = _healthBarGameObject.GetComponent <Slider>(); _health = gameObject.GetComponent <FenceHealth>(); if (_health == null) { Debug.LogError("Attach Health script"); } _repairPopUpGameObject.SetActive(false); _healthBarGameObject.SetActive(false); _health.SetHealthSlider(_healthBarSlider); _healthBarPosition = _healthBarGameObject.transform.position; status = FenceStatus.Fixed; _health.OnFenceDestroyed += FenceIsDestroyed; _health.OnFenceDamaged += FenceDamaged; CameraFollow.CameraFollowInstance.OnCameraMoved += DisableFenceUI; CameraFollow.CameraFollowInstance.OnCameraOnCamp += EnableFenceUI; }
/// <summary> /// Display a list for selecting place or fence. /// </summary> /// <param name="sender">Specifies the object of selected button in main page</param> public SelectIDPage(object sender) { if (PrivacyPrivilegeManager.CheckPermission("http://tizen.org/privilege/location") != CheckResult.Allow) { ShowNoPermissionAlert(); return; } // Clear some labels if button4 is selected. if (sender != ButtonList[4]) { InfoLabelList[2].Text = ""; InfoLabelList[3].Text = ""; } // Set a title of this page Title = ((Button)sender).Text; // Create a list for the places or geofences List <string> myList = new List <string>(); if (sender == ButtonList[1] || sender == ButtonList[2] || sender == ButtonList[6]) { // Get the information for all the places foreach (PlaceData data in perimeter.GetPlaceDataList()) { // Add the place id to the list myList.Add(data.PlaceId.ToString()); } } else if (sender == ButtonList[3] || sender == ButtonList[4] || sender == ButtonList[5] || sender == ButtonList[7]) { // Get the information for all the fences foreach (FenceData data in perimeter.GetFenceDataList()) { // Add the geofence id to the list myList.Add(data.GeofenceId.ToString()); } } // Create a list view var listView = new ListView { VerticalOptions = LayoutOptions.Center, ItemsSource = myList }; // Add a handler for list view listView.ItemSelected += async(o, e) => { if (sender == ButtonList[1]) { // Remove a selected place perimeter.RemovePlace(int.Parse(e.SelectedItem.ToString())); } else if (sender == ButtonList[2]) { // Display a page for selecting a fence type await Navigation.PushAsync(new SelectFenceTypePage(int.Parse(e.SelectedItem.ToString()), sender)); } else if (sender == ButtonList[3]) { // Remove a selected fence perimeter.RemoveGeofence(int.Parse(e.SelectedItem.ToString())); } else if (sender == ButtonList[4]) { // Start a selected fence geofence.Start(int.Parse(e.SelectedItem.ToString())); } else if (sender == ButtonList[5]) { // Stop a selected fence geofence.Stop(int.Parse(e.SelectedItem.ToString())); } else if (sender == ButtonList[6]) { // Display a page for inserting information await Navigation.PushAsync(new InsertInfoPage(int.Parse(e.SelectedItem.ToString()), sender)); } else if (sender == ButtonList[7]) { // Create a fence status for sthe elected fence FenceStatus status = new FenceStatus(int.Parse(e.SelectedItem.ToString())); // Set the value to label about the fence status InfoLabelList[2].Text = "Fence ID: " + int.Parse(e.SelectedItem.ToString()) + ", GeofenceState: "; switch (status.State) { case GeofenceState.In: InfoLabelList[2].Text += "In"; break; case GeofenceState.Out: InfoLabelList[2].Text += "Out"; break; default: InfoLabelList[2].Text += "Uncertain"; break; } // Add the duration to the label InfoLabelList[2].Text += ", Duration: " + status.Duration.ToString(); } if (sender != ButtonList[2] && sender != ButtonList[6]) { // Move to the main page await Navigation.PopToRootAsync(); } }; // Create a layout for this page Content = new StackLayout { Children = { listView }, // Set the margin of the layout Margin = 10 }; // Check the count of the list is empty if (myList.Count < 1) { // Displace an alert this.ShowEmptyAlert(); } }
private void FenceDamaged() { status = FenceStatus.Damaged; }