void Update() { int aleatoire = Random.Range(0, 9); TypeAstre typeAstre = aleatoire == 0 ? TypeAstre.Etoile : TypeAstre.Planete; Debug.Log(compteurAstres++); NettoyerAstresEloignes(25); }
private void CreerAstre(TypeAstre typeAstre, int numero, Vector2 position, double echelle = 1) { GameObject astre = Instantiate(typeAstre == TypeAstre.Planete ? planete : etoile); astre.GetComponent <SpriteRenderer>().sprite = typeAstre == TypeAstre.Planete ? listePlanetes[numero % listePlanetes.Count] : listeEtoiles[numero % listeEtoiles.Count]; astre.transform.position = new Vector3(position.x, position.y, 0); astre.transform.localScale = new Vector3((float)echelle, (float)echelle, 0); listeAstres.Add(astre); }