void Update() { if (m_planet == null && FindObjectOfType <Planet>()) { m_planet = FindObjectOfType <Planet>(); } if (m_pod == null) { foreach (Pod pod in FindObjectsOfType <Pod>()) { if (pod.m_activeVessel) { m_pod = pod; } } } pointsPositions = new Vector3[nbPoints]; for (int i = 0; i < nbPoints; ++i) { if (m_planet.GetComponent <GravityCore>().currentRocket == m_pod.gameObject) { pointsPositions[i] = m_pod.transform.position + new Vector3(m_pod.GetComponent <Rigidbody>().velocity.x *i, m_pod.GetComponent <Rigidbody>().velocity.y *i - (0.5f * m_planet.GetComponent <GravityCore>().gravityAccel *i *i), m_pod.GetComponent <Rigidbody>().velocity.z *i); } //((m_pod.GetComponent<Rigidbody>().velocity + m_planet.GetComponent<GravityCore>().finalForce) * i); } SetPoints(); }
public void CleanPod(Pod pod) { active.Remove(pod); Spawnable spawnable = pod.GetComponent <Spawnable>(); if (spawnable != null) { spawnManager.Store(spawnable); } }
public void Update() { foreach (Pod pod in FindObjectsOfType <Pod>()) { if (pod.m_activeVessel == true) { m_pod = pod; } } //TEMPORARY BEFORE MULTISHIP INTEGRATION if (m_pod) { m_atmosphereRatio = m_pod.GetComponent <AeroDynamicsCore>().m_airResistance; m_speed = m_pod.m_speed; m_altitude = m_pod.m_altitude; } //=================== float current = 0; current = (int)(1f / Time.unscaledDeltaTime); avgFrameRate = (int)current; if (m_fpsText != null) { m_fpsText.text = avgFrameRate.ToString() + " FPS"; } if (m_speedText != null) { m_speedText.text = m_speed + " Km/h"; } if (m_altitudeText != null) { m_altitudeText.text = Mathf.RoundToInt(m_altitude) + " m"; } if (m_atmosphereInfo != null) { m_atmosphereInfo.text = m_atmosphereRatio + " atm"; } }