private void ProcessClick() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; // if there's a hit if (Physics.Raycast(ray, out hit, 100)) { // get the current game object currentObject = hit.transform.gameObject; // animate it PointAnimator.Animate(currentObject); // get the center position in current view Vector3 screenCenterPos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 1f)); // update and show the panel PanelControl.UpdatePanel(screenCenterPos, currentObject); } }
// when left/right buttons on the panel are clicked // panel will be updated and the active point will be animated public void ButtonClick(string direction) { // if left arrow button is clicked if (direction == "Left") { // if we are at the first row, go to the end of the array if (CurrentRow == 0) { CurrentRow = ScatterPlot.GameObjects.Length - 1; } else { --CurrentRow; } } // otherwise it is the right button else { // if we are at the last row, go to the beginning of the array if (CurrentRow == ScatterPlot.GameObjects.Length - 1) { CurrentRow = 0; } else { ++CurrentRow; } } // get the next game object in the array GameObject go = ScatterPlot.GameObjects[CurrentRow]; // and update the panel at the last position UpdatePanel(lastPosition, go); // animate the point PointAnimator.Animate(go); }
public void SetShowcase(ITarget target, bool animate) { PostDelayed(() => { if (target != null && target.GetPoint() != null) { var targetPoint = target.GetPoint(); mHasNoTarget = false; if (animate) { var animator = PointAnimator.OfPoints(this, targetPoint); animator.SetDuration(ConfigurationOptions.FadeInDuration); animator.SetInterpolator(INTERPOLATOR); animator.Start(); // as long as the Export attribute is used is this unnessessary // var values = new Point[]{targetPoint}; // // var set = new Android.Animation.AnimatorSet(); // set.SetDuration(ConfigurationOptions.FadeInDuration); // // var xValues = new int[values.Length]; // var yValues = new int[values.Length]; // // for (int i = 0; i < values.Length; i++) // { // xValues[i] = values[i].X; // yValues[i] = values[i].Y; // } // // // var xAnimator = Android.Animation.ObjectAnimator.OfInt(this, "showcaseX", xValues); // var yAnimator = Android.Animation.ObjectAnimator.OfInt(this, "showcaseY", yValues); // // // var xAnimator = Android.Animation.ObjectAnimator.OfInt(xValues); // xAnimator.Update+= delegate(object sender, Android.Animation.ValueAnimator.AnimatorUpdateEventArgs e) { // ShowcaseX = (int) e.Animation.AnimatedValue; // Console.WriteLine("x: " + ShowcaseX); // }; // // var yAnimator = Android.Animation.ObjectAnimator.OfInt(yValues); // yAnimator.Update += delegate(object sender, Android.Animation.ValueAnimator.AnimatorUpdateEventArgs e) { // ShowcaseY = (int)e.Animation.AnimatedValue; // Console.WriteLine("y: " + ShowcaseY); // }; // // set.PlayTogether(new List<Android.Animation.Animator>(){xAnimator, yAnimator}); // // //set.Play(xAnimator).Before(yAnimator); // // set.SetInterpolator(INTERPOLATOR); // set.Start(); } else { SetShowcasePosition(targetPoint); } } else { mHasNoTarget = true; Invalidate(); } }, 100); }