public void SelectRecipe(RecipeScriptableObject recipe) { if (LastSpawnedObject) { //the last spawned object didnt get bought if (LastSpawnedObject.followUI) { Destroy(LastSpawnedObject.gameObject); } } displayedRecipes[recipe].GetComponent <RecipeButton>().buttonImage.color = displayedRecipes[recipe].GetComponent <RecipeButton>().defaultColor; Vector3 spawnPos = Camera.main.ScreenToWorldPoint(nodeSpawnPos.position); spawnPos.z = -.5f; GameObject go = Instantiate(nodePrefab, spawnPos, Quaternion.identity); go.GetComponent <Node> ().generateNode(recipe); go.GetComponent <Node> ().IsPreviewNode = true; LastSpawnedObject = go.GetComponent <UIDraggable>(); LastSpawnedObject.followUI = true; LastSpawnedObject.uiAnchor = nodeSpawnPos; if (GameManager.GetCurrentMoney() >= recipe.getPrice()) { PullArrow.enabled = true; } else { PullArrow.enabled = false; } }
public void TryDropHere(UIDraggable incomingDraggable) { if (incomingDraggable == correctDraggable) { relevantParagraph.ChangeText(); } }