예제 #1
0
    private void R_NEW_POS(SocketIOEvent obj)
    {
        Debugger.Log(obj);
        if (!isInited)
        {
            Init();
            isInited = true;
        }

        int id = -1;

        r_new_pos = obj.data["R_NEW_POS"];
        r_new_pos.GetField(ref id, "ID");
        if (id != -1 && id != 0)
        {
            agentTargetPosition = FindNextValidPosition(id);
            AStarAlgorithm.FindInfo info = new AStarAlgorithm.FindInfo()
            {
                StartPosition = agentRemote.CurrentPosition,
                EndPosition   = agentTargetPosition,
                DoneCallback  = FindPathDoneCallback
            };

            aStarAlgorithm.FindPath(info);
        }
    }
예제 #2
0
파일: NavAgent.cs 프로젝트: dqtoy/Assets
        public void AsyncStartMove(Vector3Int start, Vector3Int end, AgentRemote targetEnemy)
        {
            StartPosition = start;
            EndPosition   = end;
            currentEnemy  = targetEnemy;

            if (curMoveStep >= maxMoveStep || (path != null && path.Count == 0))
            {
                curMoveStep = 0;
            }

            AStarAlgorithm.FindInfo info = new AStarAlgorithm.FindInfo()
            {
                StartPosition = start,
                EndPosition   = end,
                DoneCallback  = FindPathDone_Callback
            };
            AStar.FindPath(info);
        }