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
1
Question by zetter · Jul 23, 2013 at 02:08 AM · error-handling

I can not get out from under the Error

I use Google Translate English is insufficient. I want to implement a method turn an array jrpg style. However, UCE0001 to implement an array: ';' expected.Insert a semicolon at the end. Error like this .... floating on line 206 Why do not know at all valid. I ask for help. #pragma strict

 static var st_Unit1 : Transform;
 static var st_Unit2 : Transform;
 static var st_Unit3 : Transform;
 static var st_Unit4 : Transform;
 var unit = [st_Unit1,st_Unit2,st_Unit3,st_Unit4];
  
 static var st_EnemyUnit1 : Transform;
 static var st_EnemyUnit2 : Transform;
 static var st_EnemyUnit3 : Transform;
 static var st_EnemyUnit4 : Transform;
 var enemy = [st_EnemyUnit1,st_EnemyUnit2,st_EnemyUnit3,st_EnemyUnit4];
  
 static var st_EnemyUnit2_1 : Transform;
 static var st_EnemyUnit2_2 : Transform;
 static var st_EnemyUnit2_3 : Transform;
 static var st_EnemyUnit2_4 : Transform;
  
 var enemy_2 = [st_EnemyUnit2_1,st_EnemyUnit2_2,st_EnemyUnit2_3,st_EnemyUnit2_4];
  
 static var st_EnemyUnit3_1 : Transform;
 static var st_EnemyUnit3_2 : Transform;
 static var st_EnemyUnit3_3 : Transform;
 static var st_EnemyUnit3_4 : Transform;
  
 var enemy_3 = [st_EnemyUnit3_1,st_EnemyUnit3_2,st_EnemyUnit3_3,st_EnemyUnit3_4];
  
 enum STATE {START,ONBATTLE,GAMECHECK,NEXTSTAGE,STAGECLEAR,GAMEOVER,IDLE,MOVE,WAIT};
  
 var arrTurn;
 var iStage : int;
 static var st_State = STATE.START;
  
 var iTick : int;
 static var st_bPhase : boolean;
  
 var bOnBattle : boolean;
  
 function Start(){
     arrTurn = new Array();
     iStage = 0;
     st_bPhase = false;
     for(var i = 0;i<unit.length; i++){
         unit[i].GetComponent(jsOnPhase).bPlayer = true;
     }
 }//
  
 //==============================================================
  
 function Update(){
     switch(st_State){
         case STATE.START:
             makeStage();
         break;
         case STATE.ONBATTLE:
             battle();
         break;
         case STATE.NEXTSTAGE:
             moveBackgroundAndEnemy();
         break;
         case STATE.STAGECLEAR:
             stageClear();
         break;
         case STATE.GAMEOVER:
             gameOver();
         break;
     }
 }//
  
 //==============================================================
  
  
 function makeStage(){
     st_State = STATE.WAIT;
     enemy[0].transform.position=Vector3(-4,1.05,5);
     enemy[1].transform.position=Vector3(-2,1.05,5);
     enemy[2].transform.position=Vector3(-0,1.05,5);
     enemy[3].transform.position=Vector3(2,1.05,5);
  
     enemy[0].tag = "enemy1";
     enemy[1].tag = "enemy2";
     enemy[2].tag = "enemy3";
     enemy[3].tag = "enemy4";
     bOnBattle = true;
     st_State = STATE.ONBATTLE;
 }//
  
 //==============================================================
  
 function gameOver(){
     bOnBattle = false;
     st_State = STATE.WAIT;
     Debug.Log("gameover");
 }//
  
 //==============================================================
  
 function stageClear(){
     bOnBattle = false;
     st_State = STATE.WAIT;
     Debug.Log("stageclear");
 }//
  
 //==============================================================
  
 function moveBackgroundAndEnemy(){
     st_State = STATE.WAIT;
     if(iStage == 1)enemy = [enemy_2[0],enemy_2[1],enemy_2[2],enemy_2[3]];
     else if(iStage == 2)enemy = [enemy_3[0],enemy_3[1],enemy_3[2],enemy_3[3]];
     st_State = STATE.START;
     Debug.Log("move background");
 }//
  
 //==============================================================
  
 function switchGUIButton(){
     //if(onSwitchMenuGUI == true)onSwitchMenuGUI = false;
     //else onSwitchMenuGUI = true;
 }//
  
 //==============================================================
  
 function gameCheck(){
     yield WaitForSeconds(0.5);
  
     if (unit[1].GetComponent(jsPlayer).bDead == true&&
         unit[2].GetComponent(jsPlayer).bDead == true&&
         unit[3].GetComponent(jsPlayer).bDead == true&&
         unit[0].GetComponent(jsPlayer).bDead == true){
         bOnBattle = false;
         yield WaitForSeconds(3);
         st_State = STATE.GAMEOVER;
         return; 
     }
  
  
     if (enemy[1].GetComponent(jsEnemy).bDead == true&&
         enemy[2].GetComponent(jsEnemy).bDead == true&&
         enemy[3].GetComponent(jsEnemy).bDead == true&&
         enemy[0].GetComponent(jsEnemy).bDead == true){
         iStage++;
         bOnBattle = false;
         if(iStage == 3){
             st_State = STATE.STAGECLEAR;
             return;
         }
         for (var i = 0;i<enemy.length;i++){
             enemy[i].active = false;
             enemy[i].tag = "";
         }
  
         yield WaitForSeconds(3);
         st_State = STATE.NEXTSTAGE;
  
     }
 }//
  
 //==============================================================
  
 function turnCheck(){
     var h = 1;
     while(h<5){
  
         var unitObj : GameObject = GameObject.FindGameObjectsWithTag("unit"+h);
         if (unitObj.GetComponent(jsPlayer).bDead == false){
             arrTurn.Push(unitObj);
         }
  
         var enemyObj : GameObject = GameObject.FindGameObjectsWithTag("enemy"+h);
         if (enemyObj.GetComponent(jsEnemy).bDead == false){
             arrTurn.Push(enemyObj);
         }
  
         h++;
     }
  
  
     //sorting
     for (var i = arrTurn.length-1; i > 0; i--){
         for (var j = 1; j < i ; j++){
             if(arrTurn[j-1].GetComponent(jsOnPhase).iSpeed < arrTurn[j].GetComponent(jsOnPhase).iSpeed){
                 var temp = arrTurn[j-1];
                 arrTurn[j-1] = arrTurn[j];
                 arrTurn[j] = temp;
             }
         }
     }
  
     for (var k = 0; k < arrTurn.Length; k++){
         Debug.Log(arrTurn[k]);
     }
 }//
  
 //==============================================================
  
 function battle(){
     st_State = STATE.IDLE;
     iTick = 0;
     while(bOnBattle){
         yield gameCheck();
         yield turnCheck();
  
         var unitobj : GameObject = (GameObject)arrTurn[iTick];
  
         if(unitobj.GetComponent(jsOnPhase).bPlayer == true){
                 st_bPhase = true;
                 yield playerTurn();
         }//
  
         else if(arrTurn[iTick].GetComponent(jsOnPhase).bPlayer == false){
  
                 st_bPhase = true;
                 yield enemyTurn();
         }//if
         iTick++;
         if (iTick > arrTurn.length){
             iTick = 0;
         }
     }
 }//
  
 //==============================================================
  
 function playerTurn(){
  
     arrTurn[iTick].SendMessage("turnChange",SendMessageOptions.DontRequireReceiver);
     while(st_bPhase)yield;
 }//
  
 //==============================================================
  
 function enemyTurn(){
     //Debug.Log("enemyTurn"+enemyTurnRndNum);
     arrTurn[iTick].SendMessage("turnChange",SendMessageOptions.DontRequireReceiver);
     while(st_bPhase)yield;
 }//


When I display the error or if, error of other drives me crazy. Please tell us how break this circle

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

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.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

Even more errors 1 Answer

Error:m TypeTree->m Index != -1 && m Overrides->size() 0 Answers

Rethrow an exception and display new exception's message in console? (C#) 1 Answer

How to solve a Parsing Error 1 Answer

can someone fix the loop error.. Why this app running only for a moment in my phone ? 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