Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.anyKeyDown)
     {
         string inputMessage = Input.inputString;
         if (Input.inputString != "" && !showmessage.getIsShow())
         {
             //Debug.Log(Input.inputString);
             //Debug.Log(Input.inputString.Substring(0,1));
             for (int i = 0; i < datacontrol.GetEnemyListLength(); i++)
             {
                 if (datacontrol.EnemyList[i] != null && datacontrol.EnemyList[i].transform.position.z >= -4.8f)
                 {
                     Data data = datacontrol.EnemyList[i].GetComponent <Data>();
                     if (Input.inputString.Substring(0, 1).ToUpper().Equals(data.CharName.ToString()) && !data.getChanged())
                     {
                         GameObject bullet = Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
                         bulletdata = bullet.GetComponent <BulletData>();
                         bulletdata.setEnemy(i);
                         GetComponent <AudioSource>().Play();
                         data.setChanged();
                         istrue = true;
                         return;
                     }
                 }
             }
         }
         if (istrue == false && !inputMessage.Equals("") && !showmessage.getIsShow())
         {
             gameControllerScript.Reduce(10);
             gameControllerScript.UpdateScore();
         }
         istrue = false;
     }
 }