internal void AddAgent(IAgentBehaviour agent, TSVector dest, GridMap map)
        {
            FlowField ff;
            int       idx = map.GetGridNodeId(dest);

            if (!_dicFlowFields.TryGetValue(idx, out ff))
            {
                ff = new FlowField(dest, map);
                _dicFlowFields[idx] = ff;
            }
            ff.AddAgent(agent);
        }
        internal FlowField UpdateAgent(IAgentBehaviour agent, TSVector preDest, TSVector dest, GridMap map)
        {
            if (preDest != dest)
            {
                FlowField ff;
                bool      hasPre = preDest != TSVector.MinValue;
                int       idx    = map.GetGridNodeId(preDest);
                if (hasPre && _dicFlowFields.TryGetValue(idx, out ff))
                {
                    ff.RemoveAgent(agent);
                }
                idx = map.GetGridNodeId(dest);
                if (!_dicFlowFields.TryGetValue(idx, out ff))
                {
                    ff = new FlowField(dest, map);
                    _dicFlowFields[idx] = ff;
                }

                ff.AddAgent(agent);
                return(ff);
            }
            return(null);
        }