Ejemplo n.º 1
0
        /// <summary>
        /// Le timer principal du code
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimerPrincipal_Tick(object sender, EventArgs e)
        {
            //Change la date et le mois
            if ((comptDate == 32 && dates.Equals(Date.Janvier.ToString())) ||
                (comptDate == 32 && dates.Equals(Date.Mars.ToString())) ||
                (comptDate == 32 && dates.Equals(Date.Mai.ToString())) ||
                (comptDate == 32 && dates.Equals(Date.Juillet.ToString())) ||
                (comptDate == 32 && dates.Equals(Date.Aout.ToString())) ||
                (comptDate == 32 && dates.Equals(Date.Octobre.ToString())) ||
                (comptDate == 31 && dates.Equals(Date.Avril.ToString())) ||
                (comptDate == 31 && dates.Equals(Date.Juin.ToString())) ||
                (comptDate == 31 && dates.Equals(Date.Septembre.ToString())) ||
                (comptDate == 31 && dates.Equals(Date.Novembre.ToString())) ||
                (comptDate == 29 && dates.Equals(Date.Fevrier.ToString())))
            {
                comptDate = 1;
                moisDate += 1;
                dates     = Enum.GetName(typeof(Date), moisDate);
            }
            else if (comptDate == 32 && dates.Equals(Date.Decembre.ToString()))
            {
                comptDate  = 1;
                moisDate   = 1;
                anneeDate += 1;
                dates      = Enum.GetName(typeof(Date), moisDate);
            }

            lion    = 0;
            mouton  = 0;
            grizzly = 0;
            rhino   = 0;
            licorne = 0;
            buffle  = 0;

            //Change le nombre d'animaux dans les infos
            foreach (Animal a in m.listeAnimaux)
            {
                switch (a.TypeAnimal)
                {
                case Animaux.Lion:
                    lion++;
                    LblQtLion.Text = lion.ToString();
                    break;

                case Animaux.Mouton:
                    mouton++;
                    LblQtMouton.Text = mouton.ToString();
                    break;

                case Animaux.Grizzly:
                    grizzly++;
                    LblQtGrizzly.Text = grizzly.ToString();
                    break;

                case Animaux.Rhinoceros:
                    rhino++;
                    LblQtRhino.Text = rhino.ToString();
                    break;

                case Animaux.Licorne:
                    licorne++;
                    LblQtLicorne.Text = licorne.ToString();
                    break;

                case Animaux.Buffle:
                    buffle++;
                    LblQtBuffle.Text = buffle.ToString();
                    break;
                }
            }

            //Affiche les informations de l'animal qu'on a right click
            if (m.placeListeAnimal != 999)
            {
                animal           = m.listeAnimaux.ElementAt(m.placeListeAnimal);
                LblInfoType.Text = "Type: " + animal.TypeAnimal.ToString();
                if (animal.Genre)
                {
                    LblInfoGenreA.Text   = "Genre: Male";
                    LblInfoEnceinte.Text = "Enceinte : Null";
                }
                else
                {
                    LblInfoGenreA.Text = "Genre: Femelle";
                    if (animal.AttendBebe == true)
                    {
                        LblInfoEnceinte.Text = "Enceinte : Oui";
                    }
                    else
                    {
                        LblInfoEnceinte.Text = "Enceinte : Non";
                    }
                }
                if (animal.Adulte)
                {
                    LblInfoAgeA.Text = "Age: Adulte";
                }
                else
                {
                    LblInfoAgeA.Text = "Age: Bebe";
                }
                if (animal.Nourri)
                {
                    LblInfoFaim.Text = "Besoin d'être nourri : Non";
                }
                else
                {
                    LblInfoFaim.Text = "Besoin d'être nourri : Oui";
                }

                switch (animal.TypeAnimal)
                {
                case Animaux.Lion:
                    PicInfoAnimal.Image = Properties.Resources.lion1;
                    break;

                case Animaux.Mouton:
                    PicInfoAnimal.Image = Properties.Resources.sheep;
                    break;

                case Animaux.Grizzly:
                    PicInfoAnimal.Image = Properties.Resources.grizzly;
                    break;

                case Animaux.Rhinoceros:
                    PicInfoAnimal.Image = Properties.Resources.rhino;
                    break;

                case Animaux.Licorne:
                    PicInfoAnimal.Image = Properties.Resources.licorne;
                    break;

                case Animaux.Buffle:
                    PicInfoAnimal.Image = Properties.Resources.buffalo;
                    break;
                }
            }

            //Affiche les informations du visiteur qu'on a right click
            if (m.placeListeVisiteur != 999)
            {
                visiteur           = m.listeVisiteur.ElementAt(m.placeListeVisiteur);
                LblInfoNomVis.Text = "Nom: " + visiteur.prenom + " " + visiteur.nom;
                if (visiteur.genre)
                {
                    LblInfoGenreVis.Text = "Sexe: Homme";
                }
                else
                {
                    LblInfoGenreVis.Text = "Sexe: Femme";
                }
                LblInfoTempsPasserVis.Text = "Temps passé depuis arrivé : " + (visiteur.tempsPasserV) + " jours";

                PicInfoVis.Image = visiteur.currentDir;
            }

            LblAnimal.Text  = "Animaux : " + m.listeAnimaux.Count;
            LblDechets.Text = "Dechets : " + m.listeTrash.Count;

            LblDate.Text = comptDate + " " + dates + " " + anneeDate;
            comptDate++;
            tempsPasser++;

            if (m.placedAnimal && (argent - m.prixAnimal) >= 0)
            {
                argent         = argent - m.prixAnimal;
                LblArgent.Text = "" + argent;
                m.placedAnimal = false;
                m.prixAnimal   = 0;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Ajouter un visiteur
        /// </summary>
        public void AjoutVisiteur()
        {
            Visiteur temp = new Visiteur(46, 21, GenererSexe(), tabAjout, listeVisiteur, listeConcierge, hero);

            listeVisiteur.Add(temp);
        }