| 1234567891011121314151617181920212223242526272829303132333435 |
- using UnityEngine;
- public class RocketController : MonoBehaviour
- {
- public RocketDataScript rocketData;
- private Rigidbody rb;
- // Start is called once before the first execution of Update after the MonoBehaviour is created
- void Start()
- {
- rocketData.SetThrustLever(0);
- rocketData.SetFuel(100);
- rb = GetComponent<Rigidbody>();
- var mass = 0f;
- foreach (var item in transform.GetComponentsInChildren<Rigidbody>())
- {
- mass += item.mass;
- }
- rocketData.SetMass(mass);
- ////rb.mass = mass;
- }
- // Update is called once per frame
- void Update()
- {
- ////if (rocketData.Thrust > 0)
- ////{
- //// rb.AddForce(rocketData.Thrust * Time.deltaTime * transform.up);
- //// rocketData.AddFuel(-1 * Time.deltaTime);
- ////}
- }
- }
|