예제 #1
0
        public void Update(double time, double delta)
        {
            if (CurrentSegment != null && CurrentSegment.EndT >= time)
            {
                CurrentSegment = null;
            }

            if (CurrentSegment == null)
            {
                while (CurrentSegment != null)
                {
                    foreach (ShotPath.Segment seg in Path.Segments)
                    {
                        if (seg.StartT <= time && seg.EndT >= time)
                        {
                            CurrentSegment = seg;
                            break;
                        }
                    }
                    break;
                }
            }

            if (CurrentSegment == null)
            {
                Active = false;
                return;
            }

            double   tDelta   = CurrentSegment.EndT - CurrentSegment.StartT;
            double   tParam   = (time - CurrentSegment.StartT) / tDelta;
            Vector3F vecDelta = CurrentSegment.EndPoint = CurrentSegment.StartPoint;

            Position = CurrentSegment.StartPoint + (vecDelta * tParam);
        }
예제 #2
0
        // dumb generator
        public ShotPath GetShotPath(Shot shot, Player player, WorldMap map)
        {
            ShotPath path = new ShotPath();

            ShotPath.Segment seg = new ShotPath.Segment();
            seg.StartPoint = shot.InitalPosition;
            seg.EndPoint   = shot.InitalPosition + (shot.InitalVelocity * shot.Lifetime);
            seg.StartT     = shot.TimeSent;
            seg.EndT       = shot.TimeSent + shot.Lifetime;
            path.Segments.Add(seg);

            return(path);
        }