Beispiel #1
0
    public void initGameManager()
    {
        // <setup ALL THE STUFF>
        playerScript = GetComponent <PlayerScript>();

        Sprite t = TilePrefab.GetComponent <SpriteRenderer>().sprite;

        cellHeight = t.textureRect.height / t.pixelsPerUnit;
        cellWidth  = t.textureRect.width / t.pixelsPerUnit;

        GameGrid.GetComponent <RectTransform>().sizeDelta = new Vector3(mapWidth * cellWidth, mapHeight * cellHeight);

        if (bgmSource)
        {
            bgmSource.clip = StaticResourceProvider.GetClip(string.IsNullOrEmpty(bgmName) ? "RandomStage" : bgmName);
            bgmSource.Stop();
            bgmSource.Play();
        }
        // </setup>
    }
Beispiel #2
0
 public static List <GameObject> LoadMapFromResources(string mapName, GameObject tileControllerPrefab, bool replaceLayers = false)
 {
     return(LoadMapFromFile("", tileControllerPrefab, replaceLayers, StaticResourceProvider.GetMapJSONObject(mapName)));
 }