i wanna increase price on all others obejcts i have triggerrs if userr ienterr he can…
- User
i wanna increase price on all others obejcts
i have triggerrs if userr ienterr he can bought i impelment it already
but i wanna if he buying item, all others items was increase 0.5 its price
so all became more expansiv all items its TycoonScript they have property price
public class TycoonScript : MonoBehaviour { [Header(“Object Trigger Settings”)] [Space] public LayerMask objectLayer; // Specific layer mask for triggering
[Header(“Audio Settings”)] [Space] public AudioClip specificAudioClip; // Specific AudioClip for playOneshot public float volumeChangeAmount = 0.5f; // Amount to change volume by public TycoonJenny tycoon; // Amount to change volume by
[Header(“Object Info”)] [Space] public float price; // Price of the object public bool bought; // Whether the object is bought or not public TextMeshPro text; /
// Example method to sell an object and add money public void SellObject(TycoonScript tycoonObject) { if (tycoonObjects.Contains(tycoonObject) && tycoonObject.bought) { money += tycoonObject.price * 0.5f; // Sell at 50% of the original price tycoonObject.bought = false; tycoonObjects.Remove(tycoonObject); Debug.Log($“Sold {tycoonObject.name}. Money now: {money}”); } else { Debug.Log(“Object not found or not bought yet.”); } }
- Assistant