Esempio n. 1
0
    // INTERFACE

    public void SetLifeStrategy(int randNumber)
    {
        if ((randNumber % 2) == 0)
        {
            Console.WriteLine("Votre tama est heureux !");
            lifeStrategy = new HappyLifeStrategy();
        }
        else
        {
            Console.WriteLine("Oh non... Votre tama est triste...");
            lifeStrategy = new SadLifeStrategy();
        }
    }
Esempio n. 2
0
 public Tama(int nbPointsDeVie, int nbPointsDeRessources, ILifeStrategy lifeStrategy)
 {
     nbPointsDeRessources = this.nbPointsDeRessources;
     nbPointsDeVie        = this.nbPointsDeVie;
     lifeStrategy         = this.lifeStrategy;
 }