Ejemplo n.º 1
0
        private void Start()
        {
            startColor = new Color(0, 0, 0, 0);
            endColor   = new Color(0, 0, 0, 1);
            trails     = new List <TrailItem>();
            var step = targetPositions.Length / initiatorPointsAmount;

            for (var i = 0; i < initiatorPointsAmount; i++)
            {
                var item = new TrailItem();
                item.go = Instantiate(trailPrefab, transform.position, Quaternion.identity);
                item.go.transform.parent = transform;
                item.trail                = item.go.GetComponent <TrailRenderer>();
                item.trail.material       = new Material(trailMaterial);
                item.emissionColor        = trailColor.Evaluate(i * (1f / initiatorPointsAmount));
                item.trail.numCapVertices = trailEndCapVertices;
                item.trail.widthCurve     = trailWidthCurve;

                item.go.transform.localPosition = targetPositions[i * step];
                item.currentTargetNum           = i * step + 1;
                item.targetLocalPosition        = targetPositions[item.currentTargetNum];

                trails.Add(item);
            }
        }
Ejemplo n.º 2
0
 public IActionResult CreateProduct(TrailItem newItem)
 {
     if (TryValidateModel(newItem))
     {
         _trailItemFactory.Add(newItem);
         return(RedirectToAction("Success"));
     }
     else
     {
         ViewBag.errors = ModelState.Values;
         return(View("CreateProduct"));
     }
 }
Ejemplo n.º 3
0
        public TrailItem UpdateVideoPosition(int seconds)
        {
            if (_currentVideo.TrailItems != null)
            {
                if (_currentVideo.TrailItems.ContainsKey(seconds))
                {
                    TrailItem trailItem = _currentVideo.TrailItems[seconds];
                    if (trailItem.Latitude != 0 && trailItem.Longitude != 0)
                    {
                        MapView.AddPoint(trailItem.Latitude, trailItem.Longitude, trailItem.SpeedMph);
                        return(trailItem);
                    }
                }
            }

            return(null);
        }
 private void UpdateInfo(TrailItem trailItem)
 {
     //    if (LabelSpeed.Dispatcher.CheckAccess())
     //    {
     //        if (trailItem == null)
     //        {
     //            LabelLatLon.Content = "";
     //            LabelSpeed.Content = "";
     //            LabelHeading.Content = "";
     //        }
     //        else
     //        {
     //            LabelLatLon.Content = trailItem.Latitude + "," + trailItem.Longitude;
     //            LabelSpeed.Content = Math.Round(trailItem.SpeedMph, 2) + " mph";
     //            LabelHeading.Content = trailItem.Heading;
     //        }
     //    }
     //    else
     //    {
     //        LabelSpeed.Dispatcher.BeginInvoke(new Action(() => UpdateInfo(trailItem)));
     //    }
 }