コード例 #1
0
    private void CreateAllWalls(LevelConfig config)
    {
        if (!config.GetSolidRightWall())
        {
            for (float i = 2; i < 6; i++)
            {
                var temp = InstantiatePlatform(config.GetRightWallConfigs()[(int)i - 2],
                                               new Vector3(4.375f, i * 4, 0),
                                               Vector3.one);
                temp.GetComponent <SpriteRenderer>().sortingLayerName = "Wall";
                platforms.Add(temp);
            }
        }
        else
        {
            var temp = InstantiatePlatform(config.GetSolidRightWallConfig(),
                                           new Vector3(4.375f, 16, 0),
                                           Vector3.one);
            temp.GetComponent <SpriteRenderer>().sortingLayerName = "Wall";
            platforms.Add(temp);
        }

        if (!config.GetSolidLeftWall())
        {
            for (float i = 2; i < 6; i++)
            {
                var temp = InstantiatePlatform(config.GetLeftWallConfigs()[(int)i - 2],
                                               new Vector3(-4.375f, i * 4, 0),
                                               Vector3.one);
                temp.GetComponent <SpriteRenderer>().sortingLayerName = "Wall";
                platforms.Add(temp);
            }
        }
        else
        {
            var temp = InstantiatePlatform(config.GetSolidLeftWallConfig(),
                                           new Vector3(-4.375f, 16, 0),
                                           Vector3.one);
            temp.GetComponent <SpriteRenderer>().sortingLayerName = "Wall";
            platforms.Add(temp);
        }
    }