private void standardizedPrefabParameters(GameObject prefab) { PlanetRotation planetRotationComponent = prefab.GetComponentInChildren <PlanetRotation>(); if (planetRotationComponent != null) { Debug.Log("PlanetRotation component will be standardized onto object " + planetRotationComponent.name); planetRotationComponent.rotationSpeed = 20f; planetRotationComponent.centralPoint = centralPoint; Transform planetModelContainerTransform = prefab.transform.GetChild(0); planetModelContainerTransform.localScale = Vector3.one; } else { Debug.LogWarning("PlanetRotation script component has not been found anywhere in object " + prefab.name); } if (cameraTransform != null) { ShowPlanetName showPlanetNameComponent = prefab.GetComponentInChildren <ShowPlanetName>(); if (showPlanetNameComponent != null) { Debug.Log("ShowPlanetName component will be standardized onto object " + showPlanetNameComponent.name); showPlanetNameComponent.cameraTransform = cameraTransform; showPlanetNameComponent.upDistance = 0.7f; } else { Debug.LogWarning("ShowPlanetName script component has not been found anywhere in object " + prefab.name); } } }
protected virtual void Awake() { _planetPropsHolderManager = GetComponentInChildren <PlanetPropsHolderManager>(); _planetRotation = GetComponent <PlanetRotation>(); InitializePlanet(); }
//public float planetDistance = 19.83f; //for Earth speed required to rotate around sun=(distance travelled/secound)/Time // Here we need timeperiod means orbit period // so Time=ditance/speed // time(orbitPeriod)=149.6*10^6(distance traveled by earth)/29.8(earth speed) // orbitSpeed=1f/orbitPeriod private void Awake() { instance = this; }