• 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
Question by alexispolak · May 28, 2013 at 04:34 AM · arrayalgorithmbookpages

Am i using good the array ?

Hello how are you? I'm having a problem with my game, it's a kind of book. Each leaf is an object, each blade is you will keep in an array. At the start of the first sheet is active, but when broken page, disable and enable the next. The problem is that I can not decipher what this fix malfunctioning. Hope you can help.

     // Update is called once per frame
     void Update () 
     {
         this.realizarMovimiento(this.chequearTeclado());
     }
     
     public string chequearTeclado()
     {
         if(Input.GetKey(KeyCode.RightArrow))
         {
             this.queBotonToca = "DERECHA";
             return "Derecha";
         }
         else if(Input.GetKey(KeyCode.LeftArrow))
         {
             this.queBotonToca = "IZQUIERDA";
             return "Izquierda";
         }
         else
         {
             this.queBotonToca = "NADA";
             return "Nada";
         }
     }
     
     public void realizarMovimiento(string botonQueTocan)
     {
         if(botonQueTocan == "Derecha")
         {
             this.realizarRotacionDIADcon(this.dameLaPaginaActiva());
         }
         else if(botonQueTocan == "Izquierda")
         {
             this.realizarRotacionDDAIcon(this.dameLaPaginaActiva());
         }
     }
 
     public void realizarRotacionDDAIcon(paginaYlado paginaActiva)
     {
 
         this.rotarDDAIa(paginaActiva);    
         if(paginaActiva.tieneAnterior == false)
         {
             //es la primera pagina
             this.desplazarHaciaArribaSiguientesDe(paginaActiva);
         }
         else
         {
             //no es la primera pagina
             this.desplazarHaciaAbajoAnterioresDe(paginaActiva);
             this.desplazarHaciaArribaSiguientesDe(paginaActiva);
         }
         this.cambiarActivoAlSiguienteDe(paginaActiva);
     }
 
     public void realizarRotacionDIADcon(paginaYlado paginaActiva)
     {
         this.rotarDIADa(paginaActiva);
         if(paginaActiva.tieneAnterior == false)
         {
             //es la primera pagina
             this.desplazarHaciaAbajoSiguientesDe(paginaActiva);
         }
         else
         {
             //no es la primera
             this.desplazarHaciaAbajoSiguientesDe(paginaActiva);
             this.desplazarHaciaArribaAnterioresDe(paginaActiva);
         }
         this.cambiarActivoAlAnteriorDe(paginaActiva);
     }
     
     public paginaYlado dameLaPaginaActiva()
     {
         int i;
         for( i=0; i<4; i++)
         {
             if(this.coleccionPaginas[i].estaActiva == true)
             {
                 return this.coleccionPaginas[i];
             }
         }
         this.check1 = "Nunca deberia entrar aca";
         return this.coleccionPaginas[i];
     }
     
     public void rotarDDAIa(paginaYlado paginaActiva)
     {
         iTween.RotateBy(paginaActiva.pagina, iTween.Hash("y", .50, "time", 4, "delay", .2));
     }
     
     public void rotarDIADa(paginaYlado paginaActiva)
     {
         iTween.RotateBy(paginaActiva.pagina, iTween.Hash("y", -.50, "time", 4, "delay", .2));
     }
Comment

People who like this

0 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 Benproductions1 · May 28, 2013 at 02:02 AM 1
Share

I can't help you because I can't read your code, because it's in a different language. Most people who could help you won't understand it either. Please translate it, so we can help you too :)

avatar image robertbu · May 28, 2013 at 04:49 AM 0
Share

A description of what you mean by "malfunctioning" might help get this question answered.

avatar image Fattie · May 28, 2013 at 07:00 AM 1
Share

I can read your code but I urge you to learn about

List

It is much easier and better to use than arrays. Never use arrays, just use List. Search on here for 100s of examples.

avatar image alexispolak · May 28, 2013 at 10:31 AM 0
Share

Thanks, i'm new in C# so i will try that !

avatar image darthbator · May 29, 2013 at 11:19 PM 0
Share

Lists are dope if you need a dynamically sized action but I don't use them like a global replacement for arrays.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 People are following this question.

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

Related Questions

Deactivate current object in array, activate next one? 2 Answers

Check times a value is next to the same value in an array 4 Answers

I'm sure this algorithm is correct...yet its not performing its function properly.. 1 Answer

How could I create a book? 6 Answers

Brute Force Search Algorithm 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