protected SpawnedPuzzleItem spawnItem(PuzzleItem item) { _itemNames.Add(item.Name); GameObject puzzleItemObj = GameObject.Instantiate(PlayState.instance.puzzleItemPrefab) as GameObject; SpawnedPuzzleItem spawnedItem = puzzleItemObj.GetComponent <SpawnedPuzzleItem>(); // Give the spawned item all the appropriate properties. foreach (string propertyName in item.getPropertyNames()) { spawnedItem.setProperty(propertyName, item.getProperty(propertyName)); } if (getRequest(spawnedItem.itemName) != null) { spawnedItem.initRequest(getRequest(spawnedItem.itemName)); } // Figure out where to spawn the item if (item.propertyExists("spawnArea")) { string spawnAreaName = item.getProperty("spawnArea") as string; addArea(spawnAreaName); _areaRooms[spawnAreaName].addPiece(spawnedItem); } return(spawnedItem); }
protected SpawnedPuzzleItem spawnItem(PuzzleItem item) { GameObject newObj = GameObject.Instantiate(PlayState.instance.puzzleItemPrefab) as GameObject; SpawnedPuzzleItem spawnedItem = newObj.GetComponent <SpawnedPuzzleItem>(); // Give the spawned item all the appropriate properties. foreach (string propertyName in item.getPropertyNames()) { spawnedItem.setProperty(propertyName, item.getProperty(propertyName)); } if (_game.getRequest(spawnedItem.itemName) != null) { spawnedItem.initRequest(_game.getRequest(spawnedItem.itemName)); } return(spawnedItem); }