Exemple #1
0
 /// <summary>
 /// Gets the lane prefab path.
 /// </summary>
 /// <returns>The lane prefab path.</returns>
 private string GetLanePrefabPath(LaneResourceType laneResType,
                                  MapType mapType = MapType.Default)
 {
     if (laneResType == LaneResourceType.SIZE || mapType == MapType.SIZE)
     {
         return("");
     }
     return(m_mapSkinFilePath + mapType.ToString() + m_laneFilePath + laneResType.ToString());
 }
Exemple #2
0
    /// <summary>
    /// Loads the lane prefabs.
    /// </summary>
    private bool LoadLanePrefabs(MapType mapType)
    {
        if (mapType == MapType.SIZE)
        {
            return(false);
        }

        string lanePath    = m_mapSkinFilePath + mapType.ToString() + m_laneFilePath;
        int    laneResSize = (int)LaneResourceType.SIZE;

        for (int i = 0; i < laneResSize; ++i)
        {
            if (m_lanePrefabs[i] != null)
            {
                // Unload previously loaded asset
                Resources.UnloadAsset(m_lanePrefabs[i]);
            }

            LaneResourceType laneResType = (LaneResourceType)i;
            m_lanePrefabs[i] = Resources.Load <GameObject>(lanePath + laneResType.ToString());
        }

        return(true);
    }