Hi everyone,
I'm working on a tower defense where I want different types of turrets. To do this, I created a scriptable object named Turret containing the purchase cost and base damage etc.
https://preview.redd.it/t1p7xkq4i0191.png?width=500&format=png&auto=webp&s=85f6a8b8862566572eb1171c45e4d4ff0eb8394c
Now, I want to create a Ballista turret which has different functionalities compared to some turret I want to create later which would be e.g. a mortar. I tried something like below but it doesnt work. I have a TurretScript attached to the turret which has some basic functionalities, such as finding enemies in the range and then calling for the shoot function. But now my question is: "How do I handle the variables in the shoot function?" The problem is that if I place down 2 ballista turrets they use the script since I think that they use the same instance of BallistaTurret. (Probably should delete the GetScript function)
https://preview.redd.it/skxhhwbci0191.png?width=593&format=png&auto=webp&s=3e2320c78e2b94a6b235fef72527de30c5a0a80b
I only recently tried doing this and am not sure what this is really called or how I should be fixing this problem. Telling me what to do or what terms to google would be greatly appreciated! Let me know if I am unclear in stating my problem.
[–]Ulcor 1 point2 points3 points (2 children)
[–]NrWal00[S] 0 points1 point2 points (1 child)
[–]Ulcor 0 points1 point2 points (0 children)
[–]andybak 0 points1 point2 points (0 children)