Post by AppThing on Jun 4, 2014 12:47:53 GMT
Hi,
I was hoping you could advise on your suggested setup for the following (3D world setup not 2D):
I want to have a series of enemy archers (which i have spawning out of a tower), which when the Player GameObject comes in range i want to begin to Fire "Arrows" at the player.
I have the EnemyArcher prefabs setup with a Killable and a triggeredSpawner script attached. The EnemyArchers lookat and follow the Player when it comes in range via a seperate EnemyController Script I created.
I also have an EnemyArrow prefab setup which contains my arrow graphic and has Killable and a timedDespawner scripts attached.
All of the above are then placed in individual PrefabPools.
Q. The (main) issue I have is how to get the "EnemyArrow" to Fire from the EnemyArcher Spawner. i.e. are you able to support rotating the spawned EnemyArrow to the same local forward as the EnemyArcher and then adding velocity to it (or do you assume a separate script will do that)? if so, what combination of configs can achieve this? - currently I can't seem to get this to work.
Also...
Initially I have been scripting the inRange calculation and then triggering the spawn manually, but i also just had a thought that perhaps if I add an additional sphere collider to the EnemeyArcher (set as Is Trigger) with a radius that is the same as the archers shooting range, then it should be able to use the Trigger Enter Event configs to start an endless spawn of single arrows (2 secs apart) and presumably the Trigger Exit Event to then stop the spawn (i assume that's what "Stop When Trigger Enter" under "Trigger Exit Event" is for?).
Q. Do you see a flaw or can suggest a better method for the above?
Many Thanks...
I was hoping you could advise on your suggested setup for the following (3D world setup not 2D):
I want to have a series of enemy archers (which i have spawning out of a tower), which when the Player GameObject comes in range i want to begin to Fire "Arrows" at the player.
I have the EnemyArcher prefabs setup with a Killable and a triggeredSpawner script attached. The EnemyArchers lookat and follow the Player when it comes in range via a seperate EnemyController Script I created.
I also have an EnemyArrow prefab setup which contains my arrow graphic and has Killable and a timedDespawner scripts attached.
All of the above are then placed in individual PrefabPools.
Q. The (main) issue I have is how to get the "EnemyArrow" to Fire from the EnemyArcher Spawner. i.e. are you able to support rotating the spawned EnemyArrow to the same local forward as the EnemyArcher and then adding velocity to it (or do you assume a separate script will do that)? if so, what combination of configs can achieve this? - currently I can't seem to get this to work.
Also...
Initially I have been scripting the inRange calculation and then triggering the spawn manually, but i also just had a thought that perhaps if I add an additional sphere collider to the EnemeyArcher (set as Is Trigger) with a radius that is the same as the archers shooting range, then it should be able to use the Trigger Enter Event configs to start an endless spawn of single arrows (2 secs apart) and presumably the Trigger Exit Event to then stop the spawn (i assume that's what "Stop When Trigger Enter" under "Trigger Exit Event" is for?).
Q. Do you see a flaw or can suggest a better method for the above?
Many Thanks...