Beispiel #1
0
        static StackObject *CalculateDistanceOnPath_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Vector3 @position = new UnityEngine.Vector3();
            if (ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Vector3_Binding_Binder != null)
            {
                ILRuntime.Runtime.Generated.CLRBindings.s_UnityEngine_Vector3_Binding_Binder.ParseValue(ref @position, __intp, ptr_of_this_method, __mStack, true);
            }
            else
            {
                @position = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
                __intp.Free(ptr_of_this_method);
            }

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @wayPoint = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            Pathfinding.Path @inputPath = (Pathfinding.Path) typeof(Pathfinding.Path).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = global::LocomotionComponentAPP.CalculateDistanceOnPath(@inputPath, @wayPoint, @position);

            __ret->ObjectType       = ObjectTypes.Float;
            *(float *)&__ret->Value = result_of_this_method;
            return(__ret + 1);
        }
Beispiel #2
0
        //float startRunTime = 0.0f;
        //float CHECK_TIME = 10.0f;

        //float startHideTime = 0.0f;
        //float CHECK_Hide_TIME = 1.0f;

        void OnPathComplete(Pathfinding.Path path)
        {
            if (path != null && path.vectorPath.Count > 0)
            {
                Vector3 pos = path.vectorPath[path.vectorPath.Count - 1];
                runPos = pos;
            }
        }
Beispiel #3
0
 void OnPathFound(Pathfinding.Path newPath)
 {
     if (!newPath.error)
     {
         //Debug.Log("found new path");
         m_Path            = newPath;
         m_CurrentWayPoint = 0;
     }
 }
 public void setTarget(Vector3 location)
 {
     waypoint    = location;
     myPathIndex = 0;
     myPath      = null;
     if (seekr)
     {
         seekr.CancelCurrentPathRequest();
         seekr.StartPath(transform.position, (Vector3)waypoint);
     }
 }
Beispiel #5
0
    public void OnPathComplete(Pathfinding.Path p)
    {
        Debug.Log("Yay, we got a path back. Did it have an error? " + p.error);
        if (!p.error)
        {
            path = p;

            //Reset the waypoint counter
            currentWaypoint = 0;
        }
    }
Beispiel #6
0
    void OnPathComplete(Pathfinding.Path p)
    {
        if (p.error)
        {
            Debug.Log("Path Failed!");
            hasPath = false;
            return;
        }

        path    = p;
        hasPath = true;
    }
Beispiel #7
0
 void FindPathComplete(Pathfinding.Path p)
 {
     if (!p.error)
     {
         m_pathList = p.vectorPath;
         moving     = true;
         Debug.Log("error : " + p.vectorPath.Count);
     }
     else
     {
         Debug.Log("right : " + p.vectorPath.Count);
         moving = false;
     }
 }
 static int Initialize(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         obj.Initialize();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #9
0
    //this function is calculate the path length

    public float CalculatePathLength(Vector3 targetPosition)
    {
        // Create a path and set it based on a target position.

        if (agent.enabled)
        {
            return(-1f);
        }

        Pathfinding.Path newPath = GetComponent <Seeker>().StartPath(agent.GetFeetPosition(), targetPosition);


        return(newPath.GetTotalLength());
    }
 public void OnPathComplete(Pathfinding.Path p)
 {
     if (!p.error)
     {
         path        = p;
         Destination = p.vectorPath.Last();
         //Reset the waypoint counter
         currentWaypoint = 0;
     }
     else
     {
         Debug.Log(string.Format("#{0}. Yey, we got a path back. Did it have an error? {1}", Worker.ID, p.error));
     }
 }
Beispiel #11
0
    public void RefreshAStarPathfindResult(Pathfinding.Path path)
    {
        isAStarPathResultRecievedInThisRun = true;
        isAStarPathError = false;

        if (path == null || path.error)
        {
            isAStarPathError = true;
            aStarLastPath    = null;
            return;
        }

        aStarLastPath = path.vectorPath;
    }
Beispiel #12
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
         watch.Start();
         Vector2 target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         Pathfinding.Instance.FindPath(transform.position, target, (Pathfinding.Path path) => {
             watch.Stop();
             currentPath = path;
             Debug.Log("Took " + watch.ElapsedMilliseconds + "ms for length " + currentPath.Count + " visited: " + path.totalVisited);
         }, debugArrows || debugCosts);
     }
 }
 static int IsDone(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         bool             o   = obj.IsDone();
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int PrepareBase(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path        obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         Pathfinding.PathHandler arg0 = (Pathfinding.PathHandler)ToLua.CheckObject <Pathfinding.PathHandler>(L, 2);
         obj.PrepareBase(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #15
0
 static int GetCurrentPath(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Seeker           obj = (Seeker)ToLua.CheckObject <Seeker>(L, 1);
         Pathfinding.Path o   = obj.GetCurrentPath();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetState(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         PathState        o   = obj.GetState();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int AdvanceState(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         PathState        arg0 = (PathState)ToLua.CheckObject(L, 2, typeof(PathState));
         obj.AdvanceState(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int WaitForPath(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Pathfinding.Path obj             = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         System.Collections.IEnumerator o = obj.WaitForPath();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int CalculateStep(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         long             arg0 = LuaDLL.tolua_checkint64(L, 2);
         obj.CalculateStep(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #20
0
        static StackObject *WaitForPath_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            Pathfinding.Path @p = (Pathfinding.Path) typeof(Pathfinding.Path).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            global::AstarPath.WaitForPath(@p);

            return(__ret);
        }
 static int GetTotalLength(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         float            o   = obj.GetTotalLength();
         LuaDLL.lua_pushnumber(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Release(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         object           arg0 = ToLua.ToVarObject(L, 2);
         obj.Release(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Log(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         string           arg0 = ToLua.CheckString(L, 2);
         obj.Log(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #24
0
 static int PostProcess(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Seeker           obj  = (Seeker)ToLua.CheckObject <Seeker>(L, 1);
         Pathfinding.Path arg0 = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 2);
         obj.PostProcess(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #25
0
 void FindPathComplete(Pathfinding.Path path)
 {
     if (!path.error)
     {
         m_pathList   = path.vectorPath;
         m_entity.Pos = m_pathList[0];
         m_curStep    = 0;
         m_isMoving   = true;
         OnMoveToNextPos();
         m_entity.Anim.SyncAction("Run");
     }
     else
     {
         m_isMoving = false;
     }
 }
 static int GetTagPenalty(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         int  arg0            = (int)LuaDLL.luaL_checknumber(L, 2);
         uint o = obj.GetTagPenalty(arg0);
         LuaDLL.lua_pushnumber(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int CanTraverse(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path      obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         Pathfinding.GraphNode arg0 = (Pathfinding.GraphNode)ToLua.CheckObject <Pathfinding.GraphNode>(L, 2);
         bool o = obj.CanTraverse(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #28
0
 static int RunModifiers(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         Seeker obj = (Seeker)ToLua.CheckObject <Seeker>(L, 1);
         Seeker.ModifierPass arg0 = (Seeker.ModifierPass)ToLua.CheckObject(L, 2, typeof(Seeker.ModifierPass));
         Pathfinding.Path    arg1 = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 3);
         obj.RunModifiers(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int DebugString(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         PathLog          arg0 = (PathLog)ToLua.CheckObject(L, 2, typeof(PathLog));
         string           o    = obj.DebugString(arg0);
         LuaDLL.lua_pushstring(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int CalculateHScore(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Pathfinding.Path      obj  = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1);
         Pathfinding.GraphNode arg0 = (Pathfinding.GraphNode)ToLua.CheckObject <Pathfinding.GraphNode>(L, 2);
         uint o = obj.CalculateHScore(arg0);
         LuaDLL.lua_pushnumber(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }