Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by logxose · Aug 13, 2016 at 08:10 AM · bugmathlinerenderercodepagelogic

Please Show me my error or a new way to do it

Hi everyone ,

I am in a really bad situation , i am trying to do scenerio mode for my game and it is clone of volfied however i am really stucked.

I show you what i have done till today:

firstly i have create meshes like this:

 void CircuitMeshCreate(int i,int textureBorderX){
         GameObject circuit = new GameObject ("Circuit "+ i, typeof(MeshFilter), typeof(MeshRenderer), typeof(MeshCollider));
         circuit.transform.position = dotVectors [i];
 
         Vector3[] vertices = {
             new Vector3 (0, 0),
             new Vector3 (1, 0),
             new Vector3 (1, 1),
             new Vector3 (0, 1)
         };
         int[] triangles = {
             0,3,1,
             2,1,3
         };
         Vector3[] normals = {
             new Vector3(0,0,1),
             new Vector3(0,0,1),
             new Vector3(0,0,1),
             new Vector3(0,0,1)
         };
         int j = Mathf.FloorToInt(i / textureBorderX);
         int xx = Mathf.FloorToInt(i / textureBorderX);
         Vector2[] uvs = {
             new Vector2 (        (float)xx / textureBorderX,                 (float)(i - (j * textureBorderX)) / textureBorderX),
             new Vector2 (        (float)(xx + 1) / textureBorderX,         (float)(i - (j * textureBorderX)) / textureBorderX),
             new Vector2 (        (float)(xx + 1) / textureBorderX,         (float)(i - (j * textureBorderX) + 1) / textureBorderX),
             new Vector2 (        (float)xx / textureBorderX,                 (float)(i - (j * textureBorderX) + 1) / textureBorderX)
         };
 
 
         Mesh mesh = new Mesh ();
         mesh.vertices = vertices;
         mesh.triangles = triangles;
         mesh.normals = normals;
         mesh.uv = uvs;
 
 
 
         MeshFilter m_Filter = circuit.transform.GetComponent<MeshFilter> ();
         m_Filter.mesh = mesh;
         MeshRenderer m_Renderer = circuit.transform.GetComponent<MeshRenderer> ();
         m_Renderer.material = material;
         circuit.transform.SetParent (this.Meshes.transform);
     }

and placed dots to all of those vertices:

 for (int i = 0; i < dotVectors.Length; i++) {
             GameObject dot = (GameObject)Instantiate (nokta, dotVectors [i], Quaternion.identity);
             dot.transform.SetParent (transform);
             dot.name = "Nokta" + i;
 }


these for detection of location of the player , easily use of line renderer and change the material of background for every crop.

however it didn't go with i want.

i coded every dots ,on the edges , Bool enable = true but the all of others "enable = false" .these for ship can walk on the enables .

 else {
             if (Input.GetKey (KeyCode.UpArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer + 1))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.y < GameObject.Find ("Nokta" + (noktaIndexer + 1)).transform.position.y) {
                         if (GameObject.Find ("Nokta" + (noktaIndexer + 1)).GetComponent<Node> ().enable) {
                             noktaIndexer++;
                             Debug.Log ("spacesiz döndürdü");
                         }
                     }
                 }
             } else if (Input.GetKey (KeyCode.DownArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer - 1))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.y > GameObject.Find ("Nokta" + (noktaIndexer - 1)).transform.position.y) {
                         if (GameObject.Find ("Nokta" + (noktaIndexer - 1)).GetComponent<Node> ().enable) {
                             noktaIndexer -= 1;
                         }
                     }
                 }
             } else if (Input.GetKey (KeyCode.LeftArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer - ekranIndex))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.x > GameObject.Find ("Nokta" + (noktaIndexer - ekranIndex)).transform.position.x) {
                         if (GameObject.Find ("Nokta" + (noktaIndexer - ekranIndex)).GetComponent<Node> ().enable) {
                             noktaIndexer -= ekranIndex;
                         }
                     }
                 }
             } else if (Input.GetKey (KeyCode.RightArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer + ekranIndex))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.x < GameObject.Find ("Nokta" + (noktaIndexer + ekranIndex)).transform.position.x) {
                         if (GameObject.Find ("Nokta" + (noktaIndexer + ekranIndex)).GetComponent<Node> ().enable) {
                             noktaIndexer += ekranIndex;
                         }
                     }
                 }
             }
         } 




it was very successul but now chaos starts.

when the player pressed "space" the inside dots must be enable so i firstly try on line renderer:

 if (Input.GetKey (KeyCode.Space)) {
             if (Changed) {
                 LineRenderer lR = transform.GetComponent<LineRenderer> ();
                 if (transform.position.x != GameObject.Find ("Ship-Beta").transform.position.x && transform.position.y != GameObject.Find ("Ship-Beta").transform.position.y ) {
                     Changed = false;
                     return;
                 }
                 lR.SetPosition (0, transform.position);
                 lR.SetPosition (1, GameObject.Find ("Ship-Beta").transform.position );
 
             }
         }


it's works well however if the player return of a move forexample he pressed 10 up and 5 down WİTH SPACE , line renderer works still 10 up so it was a crush for me and unsolveable.

then i must show you travel with space codes however it was very long so if yo read fo one direction , it is enough to understand to logic but anyway i have copied all of them (textureBordererX = ekranIndex) :

 if (Input.GetKey (KeyCode.Space) ) {
             //dolsun buralaaaaaaaaaaaaarrrrrrrrrrrrrrrrrrrr...
 
             // upppp
             //indir
             if (Input.GetKeyDown (KeyCode.UpArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer + 1))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.y < GameObject.Find ("Nokta" + (noktaIndexer + 1)).transform.position.y) {                        
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                         GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
 
                     }
                 }
             }
 
             //basılı
             if (Input.GetKey(KeyCode.UpArrow) ) {
                 if (Input.GetKeyDown (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 }
                 if (GameObject.Find ("Nokta" + (noktaIndexer + 1))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.y < GameObject.Find ("Nokta" + (noktaIndexer + 1)).transform.position.y) {
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().enable = true;
                         noktaIndexer++;
                     }
                 }
                 if (Input.GetKeyUp (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (0, -1);
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                 }
             }
             //kaldır
             if (Input.GetKeyUp(KeyCode.UpArrow)) {
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (0, -1);
                 GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
             }
             //Down
 
             //indir
 
             if (Input.GetKeyDown (KeyCode.DownArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer - 1))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.y > GameObject.Find ("Nokta" + (noktaIndexer - 1)).transform.position.y) {                        
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                         GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                     }
                 }
             }
 
             //Down basılı ve space sıralı
             if (Input.GetKey (KeyCode.DownArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer - 1))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.y > GameObject.Find ("Nokta" + (noktaIndexer - 1)).transform.position.y) {
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().enable = true;
                         noktaIndexer --;
                     }
                 }
                 if (Input.GetKeyUp (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (0, 1);
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                 }
                 if (Input.GetKeyDown (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 }
             }
 
             //kaldır
             if (Input.GetKeyUp(KeyCode.DownArrow)) {
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (0, 1);
                 GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
             }
 
             //LEeeeeFT
 
             //İndiiir
             if (Input.GetKeyDown (KeyCode.LeftArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer - ekranIndex))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.x > GameObject.Find ("Nokta" + (noktaIndexer - ekranIndex)).transform.position.x) {                        
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                         GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                     }
                 }
             }
 
             //basılı
             if (Input.GetKey (KeyCode.LeftArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer - ekranIndex))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.x > GameObject.Find ("Nokta" + (noktaIndexer - ekranIndex)).transform.position.x) {
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().enable = true;
                         noktaIndexer -= ekranIndex;
                     }
                 }
                 if (Input.GetKeyUp (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (-1,0);
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                 }
                 if (Input.GetKeyDown (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 }
             }
 
             //kaldır
             if (Input.GetKeyUp(KeyCode.LeftArrow)) {
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (-1,0);
                 GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
             }
 
             //RIıııııiiiiiGHT
 
             //indir
             if (Input.GetKeyDown (KeyCode.RightArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer + ekranIndex))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.x < GameObject.Find ("Nokta" + (noktaIndexer + ekranIndex)).transform.position.x) {                        
                         Debug.Log ("ilk nokta düzgün");
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                         GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                     }
                 }
             }
 
             //basılı
             if (Input.GetKey (KeyCode.RightArrow)) {
                 if (GameObject.Find ("Nokta" + (noktaIndexer + ekranIndex))) {
                     if (GameObject.Find ("Nokta" + noktaIndexer).transform.position.x < GameObject.Find ("Nokta" + (noktaIndexer + ekranIndex)).transform.position.x) {
                         GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().enable = true;
                         noktaIndexer += ekranIndex;
                     }
                 }
                 if (Input.GetKeyUp (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (1,0);
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                 }
                 if (Input.GetKeyDown (KeyCode.Space)) {
                     GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
                     GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 }
             }
 
             //kaldır
             if (Input.GetKeyUp(KeyCode.RightArrow)) {
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().objeninYönü = new Vector3 (1,0);
                 GameObject.Find ("Nokta" + (noktaIndexer )).GetComponent<Node> ().Changed = true;
                 GameObject.Find ("Nokta" + (noktaIndexer)).GetComponent<Node> ().BreakPoint = true;
             }
         }





im still here and i really crushed i have nothing to do more because i cant generate any solve here so

PLEASE give me a solve or a new idea to start from beginning.

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 logxose · Aug 13, 2016 at 11:24 AM

up please could someone help me ?

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

68 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 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 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 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 avatar image avatar image avatar image avatar image

Related Questions

Scaling a Line 0 Answers

Basic Logic makes absolutely no sense [JS] 2 Answers

Script function being applied to everything it's attached to logic error 2 Answers

Randomness based on time passed 2 Answers

Unexpected symbol `currentY Unexpected symbol end-of-file) Unexpected symbol Quaternion') 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