fork download
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class BallScript : MonoBehaviour
  5. {
  6.  
  7.  
  8. private bool ballIsActive;
  9. private Vector3 ballPosition;
  10. private Vector2 ballInitialForce;
  11. public GameObject playerObject;
  12. public float torque;
  13.  
  14.  
  15.  
  16. // Use this for initialization
  17. void Start()
  18. {
  19. ballInitialForce = new Vector2(100.0f, 300.0f);
  20.  
  21. ballIsActive = false;
  22.  
  23. ballPosition = transform.position;
  24. }
  25.  
  26. // Update is called once per frame
  27. void Update()
  28. {
  29.  
  30. if (Input.GetButtonDown("Jump") == true)
  31. //if (Input.touchCount > 0)
  32. {
  33.  
  34. if (!ballIsActive)
  35. {
  36.  
  37. // GetComponent<Rigidbody2D>().isKinematic = false;
  38.  
  39. GetComponent<Rigidbody2D>().AddForce(ballInitialForce);
  40.  
  41. ballIsActive = !ballIsActive;
  42. }
  43.  
  44. if (!ballIsActive && playerObject != null)
  45. {
  46. ballPosition.x = playerObject.transform.position.x;
  47.  
  48. transform.position = ballPosition;
  49.  
  50. // проверка падения шара
  51. if (ballIsActive && transform.position.y < -5)
  52. {
  53.  
  54. ballIsActive = !ballIsActive;
  55. ballPosition.x = playerObject.transform.position.x;
  56. ballPosition.y = -4.06f;
  57. transform.position = ballPosition;
  58.  
  59. GetComponent<Rigidbody2D>().isKinematic = true;
  60. }
  61. }
  62.  
  63. }
  64. }
  65. }
  66.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing an assembly reference?
prog.cs(4,27): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?
prog.cs(9,13): error CS0246: The type or namespace name `Vector3' could not be found. Are you missing an assembly reference?
prog.cs(10,13): error CS0246: The type or namespace name `Vector2' could not be found. Are you missing an assembly reference?
prog.cs(11,12): error CS0246: The type or namespace name `GameObject' could not be found. Are you missing an assembly reference?
Compilation failed: 5 error(s), 0 warnings
stdout
Standard output is empty