I'm working on a tower defense prototype. I'm using a sphere collider and Playmaker FSM's to detect and manage targets in range. Now I'd like to use Killable script and Killable Playmaker listener on my towers to manage hitpoints and send events to FSM's.
But there's a problem. I found out that the Killable script is now using the sphere collider to detect the hits and the result is that when target comes in towers shooting range Killables script is subtracting the towers hit points too. Obviously I need the hitpoints to be subtracted only when enemy collides with the tower or the tower gets shot by enemy.
Tower is setup like this:
Base object <- sphere collider and Playmaker FSM's for target detection and aiming, Killable script is here too
Turret <- this is rotated by Playmaker FSM
Spawner 1 <- Tower's bullets are spawned on this point
How can I do this with Core Gamekit? Do I need to add another collider to a sub object (turret?) to use with Killable script to detect when hitpoints need to be subtracted but how can I instruct the Killable script to use collider on a child object?
Post by DarkTonic Dev on Sept 12, 2019 23:00:00 GMT
If you can simply set the Killable's Layer and/or Tag Filter to exclude those other things from combat, then do that. Otherwise, I would suggest moving any collider / trigger you need for non-Killable functionality into a child Game Object at the same position. Then it shouldn't affect the normal combat functions that Killable has.