public override void Interact(PlayerStamina playerStamina) { CreateTextbox.Create(Name, Text + "\nThis costs <color=blue>" + price + " gems</color>."); CreateTextbox.Create(Name, new string[] { "Buy", "Cancel" }, true, true, selection => { switch (selection) { // Buy case 0: if (playerStamina.Gems >= price) { if (playerStamina.HasItem) { CreateTextbox.Create(Name, "You're already holding an item..."); } else { playerStamina.AddGems(-price); playerStamina.Item = item; CreateTextbox.Create(Name, "Come again!"); } } else { CreateTextbox.Create(Name, "You don't have enough <color=blue>gems</color>..."); } break; // Cancel case 1: CreateTextbox.Create(Name, "Come again!"); break; } }); }
public void OnOpen(PlayerStamina player) { if (!open) { player.AddGems(gems); open = true; GetComponent <MeshFilter>().mesh = openMesh; Material material = GetComponent <MeshRenderer>().material; material.SetTexture("_MainTex", openTex); material.SetTexture("_BumpMap", openMap); CreateTextbox.Create("Chest", "You found <color=blue>" + gems.ToString() + " gems</color>!"); Opened(); } }