コード例 #1
0
    void CreateTile(int x, int y, StageCellType type)
    {
        StageCell cell = new StageCell(x, y, type);

        GameObject editTile = Instantiate(editTilePrefab, transform);

        editTile.name = "tile(" + x + "," + y + ")";
        SetTilePosition(editTile, x, y);

        StageEditTile tile = editTile.GetComponent <StageEditTile>();

        tile.SetCell(cell);
        stageTiles.Add(tile);

        GameObject child = GetTileTypePrefab(type);

        if (child != null)
        {
            tile.EditType(type, child);
        }
    }
コード例 #2
0
    public GameObject GetTileTypePrefab(StageCellType type)
    {
        GameObject prefab = null;

        switch (type)
        {
        case StageCellType.Wall:
            prefab = wallPrefab;
            break;

        case StageCellType.ItemBox:
            prefab = itemBoxPrefab;
            break;

        case StageCellType.Goal:
            prefab = goalPrefab;
            break;

        case StageCellType.Player:
            prefab = playerPrefab;
            break;
        }
        return(prefab);
    }
コード例 #3
0
ファイル: StageLevelManager.cs プロジェクト: minha-lim/Unity
 public     StageCell(int x, int y, StageCellType type)
 {
     this.x    = x;
     this.y    = y;
     this.type = type;
 }