Exemplo n.º 1
0
        public Vector3 InterpolateTripPosition(int now, float max_speed)
        {

            foreach (TripSegment t in _Trip)
            {
                if (t.IsWithinThisSegment(now))
                {
                    AGT_LinearMotion motion_calculator = new AGT_LinearMotion(t.StartPosition.X, t.StartPosition.Y, t.StartPosition.Z);
                    motion_calculator.MoveTo(t.EndPosition.X, t.EndPosition.Y, t.EndPosition.Z, (t.Throttle * max_speed));

                    return motion_calculator.InterpolatePosition(t.CalculateSegmentOffset(now));
                }
            }
            //return Vector3.Empty;
            return _Trip[0].StartPosition;
        }
Exemplo n.º 2
0
        public AGT_LinearMotion CreateMotionCalculator(MoveEvent evt)
        {
            if (_current_positions.ContainsKey(evt.Name) && evt != MoveEvent.Empty)
            {
                AGT_LinearMotion motion_calculator = new AGT_LinearMotion(_current_positions[evt.Name].X, _current_positions[evt.Name].Y, _current_positions[evt.Name].Z);

                motion_calculator.MoveTo(evt.X, evt.Y, evt.Z, EventSpeed(evt));

                return motion_calculator;
            }
            return null;

        }
Exemplo n.º 3
0
 protected void AddMotionCalculator(AGT_Pawn pawn, System.Threading.ThreadStart callback)
 {
     lock (this)
     {
         AGT_LinearMotion calculator = new AGT_LinearMotion(pawn.Position.X, pawn.Position.Y, pawn.Position.Z, callback);
         if (_motion_calculators.ContainsKey(pawn.Id))
         {
             _motion_calculators.Remove(pawn.Id);
         }
         _motion_calculators.Add(pawn.Id, calculator);
     }
 }
Exemplo n.º 4
0
 private void SetCurrentPosition(string unit_name, AGT_LinearMotion mc, int time)
 {
     SetCurrentPosition(unit_name, mc.InterpolatePosition(time));
 }
Exemplo n.º 5
0
 protected void AddMotionCalculator(AGT_Pawn pawn)
 {
     lock (this)
     {
         AGT_LinearMotion calculator = new AGT_LinearMotion(pawn.Position.X, pawn.Position.Y, pawn.Position.Z);
         if (_motion_calculators.ContainsKey(pawn.Id))
         {
             _motion_calculators.Remove(pawn.Id);
         }
         _motion_calculators.Add(pawn.Id, calculator);
     }
 }