public void Init(PlanetConfig config, Transform sun) { _config = config; _lifes = config.Life; _orbit.Init(config.EllipsePosition.x, config.EllipsePosition.y, config.OrbitSpeed, config.YOffset, config.RotateClockwise, sun); _axisRotation.Init(config.AxisSpeed); SetScale(config.Diameter); }
private Planet GeneratePlanet(PlanetConfig planetConfig) { Planet planet = Instantiate(planetConfig.Pref, Vector3.zero, Quaternion.identity, this.transform).GetComponent <star_system.Planet>(); planet.Init(planetConfig, _sun); if (planetConfig.PlayerPlanet) { _playerLauncher = planet.gameObject.GetComponent <MissileLauncher>(); } return(planet); }