Below is the full documentation for all the available plugins.
Google Analytics (Unity)
Drag and drop the Prefab into the Hierarchy, and set the appropriate values in the Inspector. In your code, call the appropriate methods, then wait 24 hours for the results!
GoogleAnalytics.logEvent(string page); // or GoogleAnalytics.LogEvent(); GoogleAnalytics.LogEvent(string page, string category); GoogleAnalytics.LogEvent(string page, string category, string action); GoogleAnalytics.LogEvent(string page, string category, string action, string label); GoogleAnalytics.LogEvent(string page, string category, string action, string label, int value); |
Spawn Controller (Unity)
[youtube_sc url=http://www.youtube.com/watch?v=VsJN2-kv5gI width=600 height=338]
Drag and Drop the Prefabs “SpawnController” (just once) and “Spawner” (as many as needed) into the Hierarchy. Use the Prefab SpawnController to setup your Waves, the Spawning positions (by selecting the Spawner’s you set up in the Hierarchy), and setting the Enemy(s) that will spawn from that Spawner.
An example scene is setup and ready in the Example directory.
Note: Make sure all Enemy Prefab’s used by the Spawn Controller have a unique “name”. This is important so the built in Breed plugin doesn’t break.
Note: You will most likely need to set the order of execution of scripts for this Plugin (Edit -> Project Settings -> Script Execution Order)
// specify which wave you want to start/play SpawnController.PlayWave(int); // if possible, plays the next wave in the waves (current wave + 1 > n (waves setup in the spawn controller) = not going to happen) SpawnController.NextWave(); // if possible, plays the previous wave in the waves (current wave - 1 < 0 (first index) = not going to happen) SpawnController.PreviousWave(); // if "Play On Start" is not checked. Calling 'PlayWave' alone will not start the wave if it is paused SpawnController.ResumeWave(); // pause the wave SpawnController.PauseWave(); // adding callbacks for all the event types (beforeWave, inWave, betweenWaves, finishedLast) SpawnController.EventAdd(SpawnStates.(state of wave), theCallbackFunction); // removes the callback(s) with the specified state (beforeWave, inWave, betweenWaves, finishedLast) SpawnController.EventRemove(SpawnStates.(state of wave)); // gets the current wave Debug.Log(SpawnController.currentWave) // gets the current spawn state Debug.Log(SpawnController.spawnState) // gets the total number of waves Debug.Log(SpawnController.wavesLength) // an enemy that is spawned who is about to die, needs to call this method var spawnedEnemy : SpawnedEnemy = gameObject.GetComponent("SpawnedEnemy") as SpawnedEnemy; spawnedEnemy.Dead(); |
Here are the options in the Inspector when highlighting the SpawnController from the Hierarchy
Spawn Controller Settings
Current Wave – This is the current Wave we are playing
Play Wave – The Wave to play at start
Play On Start – If checked, will start the Spawn Controller
Restart Wave At – Once the Waves finish, you may choose which Wave to restart at (or choose not to restart)
Time Before First – The amount of time before the first Wave will begin
Time Between Waves – The amount of time between each Wave
Wave Settings
Type – The type of Wave this will be: Time or Kill. If type is Time: it will spawn Enemies from the Spawners in this Wave until the time expires (note, if any of the Waves Spawners have a type of Kill, Allow Stranglers MUST be checked in order to behave properly). Once the Time expires, it will move onto the next Wave. If type is Kill: all the Enemies spawned must be killed in order to proceed onto the next Wave
Time (only if Time type) – The amount of time this Wave will last before the Wave is complete
Allow Stranglers (only if Time type) – If checked, it will continue to spawn Enemies from the Spawners even when the set Time has been passed
Spawner Settings
Type – the type of Spawner this will be: Time or Kill. If type is Time: will spawn Enemies at a set Rate until all the Enemies set within this Spawner have been spawned. If type is Kill: it will only spawn 1 (one) Enemy at a time until that Enemy is killed, before spawning the next
Endless – If checked, will continuously spawn Enemies based on the Spawner’s settings
Rate (only if Time type) – The amount of time to spawn the Enemies
Initial Delay (only if Time type) – The amount of time to delay before spawning the first Enemy of the Spawner
Delay Between Spawns (only if Kill type) – The amount of time to delay between each Enemy to spawn once the previous Enemy has been killed
Random Spawners? – If checked, will allow you to spawn Enemies from multiple Spawners
Spawner – This is a drop down of the available Spawner’s in the Hierarchy (Prefabs with the Tag name of “Spawner”). It is recommended to set the name the Spawners to their appropriate location
Enemy Settings
Repeat – The number of times this Enemy will be repeated before moving onto the next Enemy (if any)
Random Enemies? – If checked, will randomly select an Enemy from the enemies available
Enemy – This is the Enemy you wish to be spawned
Send Messages – This allows you set send messages and values to the Enemies that are spawned. For example, setting the values for one of the messages Name and Value could be: setSpeed and 5. (function name, passed value – must be a string!)
Breed (Unity)
There are two classes for the Breed plugin: Breed
and BreedPool
. Use the Breed
class to create, remove, and get the BreedPool
object. The BreedPool
is what is used to spawn, unspawn, preload, clear, etc. the game object.
// create a pool and return a "BreedPool" object Breed.Instance().Create(string name, gameObject object) // ie Breed.Instance().Create("bullets", bulletPrefab); // remove a pool Breed.Instance().Remove(string name); // remove ALL pools, use this when loading a new level/scene Breed.Instance().RemoveAll(); // will return a "BreedPool" object var bp : BreedPool = Breed.Instance().Get(string name); // with the "BreedPool" object // spawn and return the game object // also will call "SetActiveRecursively" to true // also will call "SendMessage" calling "OnSpawn" passing the BreedPool object bp.Spawn(vector3 position, quaternion rotation); // unspawn the game object // also will call "SetActiveRecursively" to false // also will call "SendMessage" calling "OnUnspawn" bp.Unspawn(gameObject object); // preload the number of game objects bp.Preload(int count); // unspawn all will call "Unspawn" on all the active game objects bp.UnspawnAll(); // will call "UnspawnAll" and clear out all game objects bp.Clear(); // returns an int of the active game objects bp.GetActiveCount(); // returns an int of the available game objects bp.GetAvailableCount(); // returns the original game object used to "Instantiate" bp.GetObject(); |