Exemplo n.º 1
0
    public void InitPath()
    {
        GameObjectPathList pathlist = Resources.Load <GameObjectPathList>(Const.Path_Config_Obj_Ready);

        PathInfo0.PathLength = pathlist.PathLength;
        PathInfo0.Path       = pathlist.Path;
        PathInfo0.PathUp     = pathlist.PathUp;
        PathInfo0.PathRight  = pathlist.PathRight;

        if (Type == E_Type.City)
        {
            pathlist             = Resources.Load <GameObjectPathList>(Const.Path_Config_Obj_City);
            PathInfo1.PathLength = pathlist.PathLength;
            PathInfo1.Path       = pathlist.Path;
            PathInfo1.PathUp     = pathlist.PathUp;
            PathInfo1.PathRight  = pathlist.PathRight;
        }

        if (Type == E_Type.Gorge)
        {
            pathlist             = Resources.Load <GameObjectPathList>(Const.Path_Config_Obj_Gorge);
            PathInfo1.PathLength = pathlist.PathLength;
            PathInfo1.Path       = pathlist.Path;
            PathInfo1.PathUp     = pathlist.PathUp;
            PathInfo1.PathRight  = pathlist.PathRight;
        }

        pathlist             = Resources.Load <GameObjectPathList>(Const.Path_Config_Obj_Land);
        PathInfo2.PathLength = pathlist.PathLength;
        PathInfo2.Path       = pathlist.Path;
        PathInfo2.PathUp     = pathlist.PathUp;
        PathInfo2.PathRight  = pathlist.PathRight;
        ReversePath(PathInfo2);
    }
Exemplo n.º 2
0
        private void CreatePools(PathInfo pathInfo)
        {
            // 不仅只存在于内存当中,还存在与项目里面
            GameObjectPathList pathList = ScriptableObject.CreateInstance <GameObjectPathList>();

            pathList.PathLength = pathInfo.PathLength;
            pathList.Path       = pathInfo.Path;
            pathList.PathUp     = pathInfo.PathUp;
            pathList.PathRight  = pathInfo.PathRight;

            AssetDatabase.CreateAsset(pathList, "Assets/Resources/landpath.asset");
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }