private void AddWallToTileMap(GameObject gObject) { Wall wall = gObject.GetComponent <Wall>(); if (wall != null) { wall.AddToTilemap(); } }
private static ILevelElement InstantiateWall(WallData data, Transform parent) { GameObject prefab = LevelElementPrefabTable.instance.GetPrefab(data); if (prefab == null) { Debug.LogError("Could not create wall: Prefab not found!"); } GameObject gameObject = Object.Instantiate(prefab, parent); Wall wall = gameObject.GetComponent <Wall>(); if (wall == null) { Debug.LogError("Prefab for Wall is faulty: Has no Wall component!"); return(null); } wall.InitPos(data.pos); wall.AddToTilemap(); return(wall); }