RocketController.cs 867 B

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. public class RocketController : MonoBehaviour
  3. {
  4. public RocketDataScript rocketData;
  5. private Rigidbody rb;
  6. // Start is called once before the first execution of Update after the MonoBehaviour is created
  7. void Start()
  8. {
  9. rocketData.SetThrustLever(0);
  10. rocketData.SetFuel(100);
  11. rb = GetComponent<Rigidbody>();
  12. var mass = 0f;
  13. foreach (var item in transform.GetComponentsInChildren<Rigidbody>())
  14. {
  15. mass += item.mass;
  16. }
  17. rocketData.SetMass(mass);
  18. ////rb.mass = mass;
  19. }
  20. // Update is called once per frame
  21. void Update()
  22. {
  23. ////if (rocketData.Thrust > 0)
  24. ////{
  25. //// rb.AddForce(rocketData.Thrust * Time.deltaTime * transform.up);
  26. //// rocketData.AddFuel(-1 * Time.deltaTime);
  27. ////}
  28. }
  29. }