Ejemplo n.º 1
0
    private void SetPathSprites()
    {
        DungeonSet set;

        if (SceneUtil.IsCurrentLevelIndex)
        {
            Debug.Log("loading dungeon set from world index");
            set = SceneUtil.GetSet(SceneUtil.LevelIndex);
        }
        else
        {
            Debug.Log("picking a random dungeon set");
            set = SpriteList.GetRandomDungeonSet();
        }
        SoundManager.Instance.Loop(set.Music);
        Sprite[] tiles = set.PathTiles;
        foreach (FloorManager floor in floors)
        {
            for (int i = 0; i < floor.Rows; i++)
            {
                for (int j = 0; j < floor.Columns; j++)
                {
                    bool   isRowEven = (i % 2 == 0);
                    bool   isColEven = (j % 2 == 0);
                    Sprite tile      = null;
                    if (isRowEven)
                    {
                        if (isColEven)
                        {
                            tile = tiles[TOP_LEFT];
                        }
                        else
                        {
                            tile = tiles[TOP_RIGHT];
                        }
                    }
                    else
                    {
                        if (isColEven)
                        {
                            tile = tiles[BOT_LEFT];
                        }
                        else
                        {
                            tile = tiles[BOT_RIGHT];
                        }
                    }
                    SetTileSprite(floor, tile, i, j);
                }
            }
        }
    }