Create Object Spawner Development Tool

Author: 
schmjdt
schmjdt's picture
Assignee: 
Labels: 
Status: 
Priority: 

Create a script called ObjectSpawner.cs that can be attached to any game object with a RectTransform component.

Class
Object Spawner
  • RectTransform rectTransform;
  • [serializable] List<Prefab> objects;
  • [serializable] List<int> objectWeights;
  • [serializable] float spawnInterval; //How often to try to spawn in seconds
  • [serializable] float spawnCount; //How many to spawn every interval
  • [serializable] float spawnChance; //Chance of spawn being successful per interval
  • [serializable] float startDelay; //How long to wait until fist spawn
  • [serializable] float lifeSpan; //How long to until spawner is becomes inactive or destroyed. 
  • [serializable] float maxSpawns; //How many spawns until spawner is becomes inactive or destroyed. 
  • void Update() {
    //Handle random selection fo objets based on their weights on the members values.
    }

Comments

2

Sup Joe, 

I am working on the format of these tasks and the comments so dont be surprised if you have trouble edditing what I have above. If you have you TP email set up you should get an email from this comment since I made you the author of the above task. Take a look at the basic footprint I detailed above and let me know what you think,

Submitted by el_bearduno on Fri, 2015-12-18 01:27
el_bearduno's picture

Editing should all work pretty nice now! I swear I'll stop working on the website any second now. I did do some Unity dev while I waited for Star Wars to start!

Submitted by el_bearduno on Fri, 2015-12-18 03:49
el_bearduno's picture

Add new comment

Basic Editor

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain Text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.