Beispiel #1
0
        public static void WalkTo(Vector3 tgt)
        {
            if (!newPF)
            {
                Target = tgt;
                return;
            }

            if (PfNodes.Any())
            {
                float dist = tgt.Distance(PfNodes[PfNodes.Count - 1]);
                if (dist > 900 || dist > 300 && p.Distance(tgt) < 2000)
                {
                    PfNodes = NavGraph.FindPathRandom(p.Position, tgt);
                }
                else
                {
                    PfNodes[PfNodes.Count - 1] = tgt;
                }
                Target = PfNodes[0];
            }
            else
            {
                if (tgt.Distance(p) > 900)
                {
                    PfNodes = NavGraph.FindPathRandom(p.Position, tgt);
                    Target  = PfNodes[0];
                }
                else
                {
                    Target = tgt;
                }
            }
        }
        public static void WalkTo(Vector3 tgt)
        {
            if (!NewPf)
            {
                Target = tgt;
                return;
            }

            if (_pfNodes.Any())
            {
                float dist = tgt.Distance(_pfNodes[_pfNodes.Count - 1]);
                if (dist > 900 || dist > 300 && P.Distance(tgt) < 2000)
                {
                    _pfNodes = NavGraph.FindPathRandom(P.Position, tgt);
                }
                else
                {
                    _pfNodes[_pfNodes.Count - 1] = tgt;
                }
                Target = _pfNodes[0];
            }
            else
            {
                if (tgt.Distance(P) > 900)
                {
                    _pfNodes = NavGraph.FindPathRandom(P.Position, tgt);
                    Target   = _pfNodes[0];
                }
                else
                {
                    Target = tgt;
                }
            }
        }