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 AritzCoplas · Dec 02, 2014 at 12:23 AM · cameraturn based

Turn based game, view the moves of the computer controlling enemys turn

Hi everybody!

Im developing a turn based game. Its based on a boardgame where you controll some character that are survivours an the enemy (computer) controls zombies. I`ve made a function that controls the zombies in enemies turn and moves them to reach the survivous. It does it automatically. What i need to perform is the following:

In enemis turn instead of procesing all automaticalli and show me the zombies already moved at the end of the turn, i want the camera tu focus one by one all the zombies and show the movement, one by one! until all the zombies have moved.

i have a funcion that uses a "foreach (zombie) do Move " .

How can i do this? any idea? Ive tried moving the camera to the location of each zombie before they move but it all happens very fast and im not able to see it.

Thanks to all!

https://www.youtube.com/watch?v=gj07BISWs0U

The turn of the enemy should look like in this game, they move one by one making their stuff

Comment
Add comment · Show 5
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 Slev · Dec 02, 2014 at 12:35 AM 0
Share

Probably want to use coroutines which will allow you force the "move handler" to pause while the zombies animate or do their thing"

avatar image Cherno · Dec 02, 2014 at 01:10 AM 0
Share

Why don't you just re-use the move function that is used for the player characters for your zombies?

avatar image AritzCoplas · Dec 02, 2014 at 04:11 AM 0
Share

Slev: Yes i have tried using coroutine but it seems that with the foreach statement it doesnt work. $$anonymous$$aybe using for?

ahmedbenlakhdhar : The foreach is trigerred by a function that is called when i end my turn not in update. Ins$$anonymous$$d of foreach what should i use?

Thanks to all!!

avatar image Kiwasi · Dec 02, 2014 at 06:22 AM 0
Share

Off topic note: Learning to spell correctly when typing on a computer will help immensely in reducing accidental errors in your code.

avatar image jaja1 · Dec 02, 2014 at 06:26 AM 0
Share

This is a little vague in my opinion. We can give suggestions as to going about doing it but I suggest you at least try some code and post it here if you encounter difficulties. Until you write some actual code, there's no way to tell where you went wrong or what you are missing.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Kiwasi · Dec 02, 2014 at 06:30 AM

You information is very sparse. But here is some pseudo code.

 IEnumerator DoEnemyTurn (){
     foreach (Enemy enemy in allEnemys){
         yield return StartCoroutine(enemy.DoTurn());
         yield return new WaitForSeconds(0.1f);
     }
 }
 
 IEnumerator DoTurn (){
     Debug.Log("Starting turn " + name);
     yield return new WaitForSeconds(1);
     Debug.Log("Finished turn " + name);
 }

Without more details I can't give you more then that. Please note that the forums are better suited for general design questions. UA is for specific technical details.

Comment
Add comment · 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
0

Answer by AritzCoplas · Dec 02, 2014 at 12:17 PM

Thanks to all! Ill post some code and explain it better:

When i finish my turn making click on a button (finish turn) it goes to the following:

 void StartZombiesTurn (){
     
         PerformZombieActions (); //the zombies move or attack
         ActivateSpawners (); //the zombies appear in the spawners 
     
 }

Here is the code of perform actions:

 void PerformZombieActions(){
 
         zombies = null; //Sets "zombies" (List<Zombie>) to null
         zombies = boardManager.GetAllZombiesInGame ();
 
         if (zombies.Count != null) {
 
             foreach (Zombie z in zombies){
 
 
                                 //each zombie has an amount of actions;
                        //this for is to make one action for each action available
                  for(int x = 0; x< z.GetActions(); x++){ 
 
                     z.MakeAction();
 
                 }
 
             }
         }
 }


All this works correctly, excepting that i cant see it step by step. Thanks to all of you!

Comment
Add comment · 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

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make camera position relative to a specific target. 1 Answer

TPS camera in multiplayer... 2 Answers

FPS weapon natural look 0 Answers

AddForce to Camera 1 Answer

Game preview incorrect! 0 Answers


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