public override void upgradeStructure() { if (batUpgrade != null && batUpgrade.GetComponent <Batiment>().canBeConstruct()) { batUpgrade.GetComponent <Batiment>().constructBat(); desactiverCanvas(); Caserne bat = batUpgrade.GetComponent <Caserne>(); nbrMaxHab = bat.nbrMaxHab; description = bat.description; hab = bat.hab; nomBatiment = bat.nomBatiment; GameObject del = this.gameObject.transform.Find("Model").gameObject; del.name = "del"; GameObject o = Instantiate(batUpgrade.transform.Find("Model").gameObject, this.transform); o.name = "Model"; o.transform.parent = this.transform; GetPartModel(); Destroy(del); batUpgrade = bat.batUpgrade; afficheCanvas(); } }
static void Main(string[] args) { Forum ff = new Forum(); Building maCaserne = ff.CreationCaserne(); System.Console.WriteLine("Création d'une nouvelle " + maCaserne.GetType()); System.Console.WriteLine("Abrite " + maCaserne.Population); Caserne ca = ff.CreationCaserne(); ca.CreationFantassin(); maCaserne = ff.CreationMaison(); System.Console.WriteLine("Création d'une nouvelle " + maCaserne.GetType()); System.Console.WriteLine("Abrite " + maCaserne.Population); System.Console.ReadKey(); }