Esempio n. 1
0
        public ZombieInvasionEnigmaPanel()
        {
            //modification des parametres du panel de base
            Screen myScreen = Screen.PrimaryScreen;

            this.Width  = (myScreen.WorkingArea.Width);
            this.Height = 400;

            //création et ajout des coeurs
            Coeur coeur1 = new Coeur(new Point(this.Right - 50, 0));
            Coeur coeur2 = new Coeur(new Point(this.Right - 100, 0));
            Coeur coeur3 = new Coeur(new Point(this.Right - 150, 0));

            coeurs.Add(coeur1);
            coeurs.Add(coeur2);
            coeurs.Add(coeur3);

            //création du batiment
            pbxBatiment.Size     = Properties.Resources.Batiment.Size;
            pbxBatiment.Image    = Properties.Resources.Batiment;
            pbxBatiment.Location = new Point(this.Width / 2 - pbxBatiment.Width / 2, this.Bottom - pbxBatiment.Height);

            //déclaration de deux nombres Randoms
            iTickRandomGauche = NextRandom();
            iTickRandomDroite = NextRandom();

            //placement du label
            lblChronometre.Text     = "Timer : " + Convert.ToString(iChronometre);
            lblChronometre.Font     = new Font("Arial", 24, FontStyle.Bold);
            lblChronometre.Size     = new Size(120, 30);
            lblChronometre.Location = new Point(30, 0);

            //mise en place d'un timer
            timer.Interval = 2; // 10 miliseconde
            timer.Tick    += new EventHandler(Timer_Tick);

            //changement du curseur
            this.Cursor = new Cursor(Properties.Resources.CibleRouge.GetHicon());//de base on met le curseur en rouge

            //création d'un evenement de click
            MouseClick += new MouseEventHandler(PanelClick);

            //ajout des images dans les controls
            Controls.Add(lblChronometre);
            Controls.Add(pbxCible);
            Controls.Add(pbxBatiment);
            Controls.Add(coeur1);
            Controls.Add(coeur2);
            Controls.Add(coeur3);
        }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Ennemi bwate = collision.gameObject.GetComponent <Ennemi>();
        Coeur  coeur = collision.gameObject.GetComponent <Coeur>();

        if (bwate != null)
        {
            Debug.Log("Aïe");
            GameManager.Instance.DamageToBilly(1);
        }
        if (coeur != null)
        {
            Debug.Log("Yes");
            GameManager.Instance.HealToBilly(1);
            Destroy(coeur.gameObject);
        }
    }