fork download
  1. using System;
  2. using UnityEngine;
  3. using System.Collections;
  4.  
  5. public class carmove2 : MonoBehaviour {
  6. public bool go;
  7. private float posz;
  8.  
  9. // Use this for initialization
  10. void Start () {
  11. go = false;
  12. }
  13.  
  14. // Update is called once per frame
  15. void Update () {
  16. posz = transform.position.z;
  17.  
  18. if (!go && posz >= 93.4f && posz <= 93.6f) {
  19. // Что здесь?
  20. } else {
  21. transform.Translate(0, 0, 0.2f);
  22. };
  23.  
  24. if (posz >= 130) {
  25. Destroy(gameObject);
  26. }
  27. }
  28. }
  29.  
  30. using UnityEngine;
  31. using System.Collections;
  32.  
  33. public class lightmanager1 : MonoBehaviour {
  34. private bool pressed;
  35.  
  36. // Use this for initialization
  37. void Start () {
  38.  
  39. }
  40.  
  41. // Update is called once per frame
  42. void Update() {
  43. foreach (Touch touch in Input.touches) {
  44. if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled) {
  45. pressed = !pressed;
  46. break;
  47. }
  48. }
  49. // Может так?
  50. this.GetComponent<carmove2>().go = pressed;
  51. }
  52. }
  53.  
  54. public class lightmanager2 : MonoBehaviour {
  55. private bool pressed;
  56. private carmove2 scr1;
  57.  
  58. // Use this for initialization
  59. void Start () {
  60. scr1 = new carmove2();
  61. }
  62.  
  63. // Update is called once per frame
  64. void Update() {
  65. foreach (Touch touch in Input.touches) {
  66. if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled) {
  67. pressed = !pressed;
  68. break;
  69. }
  70. }
  71. // Или может так?
  72. scr1.go = pressed;
  73. }
  74. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(30,1): error CS1529: A using clause must precede all other namespace elements except extern alias declarations
prog.cs(30,1): warning CS0105: The using directive for `UnityEngine' appeared previously in this namespace
prog.cs(2,7): (Location of the symbol related to previous warning)
prog.cs(31,1): error CS1529: A using clause must precede all other namespace elements except extern alias declarations
prog.cs(31,1): warning CS0105: The using directive for `System.Collections' appeared previously in this namespace
prog.cs(3,14): (Location of the symbol related to previous warning)
Compilation failed: 2 error(s), 2 warnings
stdout
Standard output is empty