Example #1
0
        public override void OnThink()
        {
            base.OnThink();

            if (ControlMaster != null && m_Path != null && m_Path.Count > 0)
            {
                Vertex v = m_Path[m_Path.Count - 1];
                Mobile m = ControlMaster;

                if (m.NetState != null)
                {
                    if (Math.Abs(v.DistanceTo(m.Location) - v.DistanceTo(Location)) > 10)
                    {
                        Frozen = true;
                    }
                    else
                    {
                        Frozen = false;
                    }

                    if (CurrentWayPoint == null)
                    {
                        CurrentWayPoint = new WayPoint();
                        CurrentWayPoint.MoveToWorld(v.Location, Map);
                    }

                    int dist = v.DistanceTo(Location);

                    if (dist < (v.Teleporter ? 1 : 3) || dist > 100)
                    {
                        m_Path.RemoveAt(m_Path.Count - 1);

                        if (m_Path.Count > 0)
                        {
                            if (CurrentWayPoint == null)
                            {
                                CurrentWayPoint = new WayPoint();
                            }

                            CurrentWayPoint.MoveToWorld(m_Path[m_Path.Count - 1].Location, Map);
                        }
                        else
                        {
                            Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(3), CommandFollow, m);
                            Say(1076051); // We have reached our destination
                            CommandStop(m);
                        }
                    }
                }
            }
        }
Example #2
0
        public void StopGuiding()
        {
            CurrentSpeed = PassiveSpeed;

            if (CurrentWayPoint != null)
            {
                CurrentWayPoint.Delete();
            }

            if (m_Path != null)
            {
                m_Path.Clear();
            }

            Controlled = true;
            m_Path     = null;
        }
Example #3
0
        public void StartGuiding(List <Vertex> path)
        {
            m_Path = path;

            if (ControlMaster != null && m_Path != null && m_Path.Count > 0)
            {
                if (m_Path.Count > 1)
                {
                    m_Path.RemoveAt(m_Path.Count - 1);
                }

                if (CurrentWayPoint == null)
                {
                    CurrentWayPoint = new WayPoint();
                }

                CurrentWayPoint.MoveToWorld(m_Path[m_Path.Count - 1].Location, Map);

                AIObject.Action = ActionType.Wander;
                CurrentSpeed    = ActiveSpeed;
                Controlled      = false;
                Say(1076114); // Please follow me.
            }
        }