Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by trunglehuynh · Apr 17, 2015 at 10:18 PM · spawnzombieenemies

How to store enemies spawn schedule for each scene ?

Hi all,

I am creating a zombies shooting game, and this game has 10 kind of zombies , such as: zombie1 ,zombie2 ,..zombie10 . I want that each scene, GameController create 5 zombies and those zombies are created in a schedule (in order) such as:

scene 1: zombie1, zombie1, zombie2, zombie5, zombie5

scene 2: zombie2, zombie1, zombie2, zombie7, zombie7

scene 2: zombie2, zombie2, zombie2, zombie7, zombie7

I saw "plants vs zombies" can spawn zombies right time and in order but I do not know how to do.

The question is that,

How they do it ?

How can I save those schedules ?

Are there any kind data-structures to save those schedules ?

Thank everyone.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by siaran · Apr 18, 2015 at 12:01 AM

You could just put a gameobject with a 'spawnenemies' script on it in each scene that spawns the correct enemies?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image trunglehuynh · Apr 18, 2015 at 02:59 AM 0
Share

Hi Siaran,

thank your help. But if the game has 100 scenes, I have to make 100 scripts just for spawn enemies, So it is good but I want to find another way.

thanks.

avatar image siaran · Apr 18, 2015 at 10:22 AM 0
Share

No, you write just 1 script to spawn enemies, make a public array of enemies, then use that to instantiate. Like

 public class Spawner : $$anonymous$$onoBehaviour {
 
 public GameObject[] enemiesThisLevel;
 
 void Start(){
 
  for(int i = 0; i < enemiesThisLevel.length; i++){
   Instantiate(enemiesThisLevel[i]);
  }
  }
 }

You can use the same script in every scene. (This is a very simple one that doesn't take care of spawn positions or anything, but the point is - you really only need to write 1 script).

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to spawn enemy? (Enemies) 1 Answer

Help? Im trying to get my zombie prefab to spawn, but stop them spawning after a set spawn limit. 1 Answer

Spawn help? 0 Answers

Zombie Wave Spawning script 1 Answer

Enemy spawn 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges