示例#1
0
        private void LoadGraph()
        {
            ResourcesComponent resourcesComponent = Game.Scene.GetComponent <ResourcesComponent>();

            resourcesComponent.LoadBundle("graph.unity3d");
            GameObject graphRef = resourcesComponent.GetAsset("graph.unity3d", "Graph") as GameObject;
            TextAsset  graph    = graphRef.Get <TextAsset>("Graph");

            this.AStarConfig.graphs = DeserializeHelper.Load(graph.bytes);
        }
示例#2
0
        public override void Awake(PathfindingComponent self)
        {
            self.PathReturnQueue = new PathReturnQueue(self);
            self.PathProcessor   = new PathProcessor(self.PathReturnQueue, 1, false);

            // 读取寻路配置
            self.AStarConfig = new AStarConfig(); //MongoHelper.FromJson<AStarConfig>(File.ReadAllText("./pathfinding.config"));
            self.AStarConfig.pathProcessor = self.PathProcessor;

            // 读取地图数据
            self.AStarConfig.graphs = DeserializeHelper.Load("../Config/graph.bytes");
        }
示例#3
0
        public override void Awake(PathfindingComponent self)
        {
            self.PathReturnQueue = new PathReturnQueue(self);
            self.PathProcessor   = new PathProcessor(self.PathReturnQueue, 1, false);

            // 读取寻路配置
            self.AStarConfig = new AStarConfig(); //MongoHelper.FromJson<AStarConfig>(File.ReadAllText("./pathfinding.config"));
            self.AStarConfig.pathProcessor = self.PathProcessor;

            Game.Scene.GetComponent <ResourcesComponent>().LoadBundle("pathfind.unity3d");
            TextAsset textAsset = Game.Scene.GetComponent <ResourcesComponent>().GetAsset("pathfind.unity3d", "graph") as TextAsset;

            //测试
            self.AStarConfig.graphs = DeserializeHelper.Load(textAsset.bytes);
        }
示例#4
0
 private void LoadGraph()
 {
     this.AStarConfig.graphs = DeserializeHelper.Load("../Config/graph.bytes");
 }