void Start() { new CommandRegistration("VP_CloudSize", (string[] args) => { if (args.Length < 1) { GeoTools.Log("ERROR!"); } try { int cloudSize = int.Parse(args[0]); if (cloudSize < 0 || cloudSize > 3000) { GeoTools.Log("Your cloud amount is not available. "); } else { CloudSize = cloudSize; LoadCloud(); } } catch { GeoTools.Log("Could not parse " + args[0] + "to cloud amount"); } GeoTools.Log("There will be " + CloudSize.ToString() + " clouds" + "\n"); }, "Set CloudSize.No bigger than 80 and no less than 10."); }
public void SpawnCloudFromPool(Vector2 position, CloudSize cloudSize) { GameObject cloud = GetObjectFromPool(position); if (cloud != null) { switch (cloudSize) { case CloudSize.Big: cloud.transform.localScale = Vector3.one; cloud.renderer.sortingLayerName = "Background"; cloud.renderer.sortingOrder = 3; break; case CloudSize.Normal: cloud.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); cloud.renderer.sortingLayerName = "Background"; cloud.renderer.sortingOrder = 2; break; case CloudSize.Little: cloud.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); cloud.renderer.sortingLayerName = "Background"; cloud.renderer.sortingOrder = 1; break; } int index = Random.Range(0, cloudSprites.Count); ((SpriteRenderer)cloud.renderer).sprite = cloudSprites[index]; } }