Exemple #1
0
 public Zone(Etat.EtatName etat, Position position, Artefacts.ArtefactsName artefacts, bool heliport)
 {
     this.etat      = etat;
     this.artefacts = artefacts;
     this.position  = position;
     this.heliport  = heliport;
 }
        /**
         * Prendre un artefact de l'ile
         */
        public bool takeArtefact()
        {
            int compteur = 0;

            Artefacts.ArtefactsName artefacts = zone.getArtefacts();
            foreach (TresorCard.TresorCardName t in playerCards)
            {
                if (TresorCard.getArtefactsAssociated(t) == artefacts && artefacts != Artefacts.ArtefactsName.None)
                {
                    compteur++;
                }
            }
            if (compteur >= 4)
            {
                zone.setArtefacts(Artefacts.ArtefactsName.None);
                modele.getListArtefacts().Add(artefacts);
                for (int i = 0; i < 4; i++)
                {
                    this.defausseCard(Artefacts.getKeyAssociated(artefacts));
                }
                return(true);
            }
            else
            {
                Console.WriteLine("Not allow here !");
                return(false);
            }
        }
Exemple #3
0
    // Update is called once per frame
    void Update()
    {
        if (zone.getEtat() != etat)  // ici je teste si on a un changement d'état, puis si c'est le cas, alors je change d'état, et je met à jour mon sprite
        {
            etat       = zone.getEtat();
            sprite     = Resources.Load <Sprite>(Etat.getSpritePath(etat));
            img        = GetComponent <Image>();
            img.sprite = sprite;
        }

        Artefacts.ArtefactsName a = zone.getArtefacts();
        if (a != Artefacts.ArtefactsName.None)
        {
            transform.GetChild(0).transform.GetComponent <Image>().sprite = Resources.Load <Sprite>(Artefacts.getSpritePath(a));
        }
        else
        {
            transform.GetChild(0).transform.GetComponent <Image>().enabled = false;
        }

        if (modele.getRoundOf().zonesSafeToMove().Contains(zone))
        {
            transform.GetChild(1).transform.GetComponent <Image>().enabled = true;
        }
        else
        {
            transform.GetChild(1).transform.GetComponent <Image>().enabled = false;
        }


        if (zone.isHeliport())
        {
            transform.GetChild(2).transform.GetComponent <Image>().enabled = true;
        }
        else
        {
            transform.GetChild(2).transform.GetComponent <Image>().enabled = false;
        }

        /*if (Input.GetMouseButtonDown(0))
         * { // finalement inutile grâce au boxcollider
         *  print("click");
         *  RaycastHit hit;
         *  Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         *
         *  if (Physics.Raycast(ray, out hit))
         *  {
         *      if (hit.transform.name == "MyObjectName")
         *      {
         *          print("My object is clicked by mouse");
         *      }
         *  }
         * }*/
    }
    public void OnClick()
    {
        Player p = modele.getRoundOf();
        //for(int i = 0; i < 4; i++)
        // p.getCards().Add((TresorCard.TresorCardName.ClefFeu));
        bool haveTake = false;

        if (p.canAct())
        {
            Artefacts.ArtefactsName artefacts = p.getZone().getArtefacts();
            if (p.takeArtefact())
            {
                p.addAction();
                GameObject g = GameObject.Find(Artefacts.toString(artefacts));
                print("trouve " + g.name);
                Texture sprite = Resources.Load <Texture>(Artefacts.getSpritePath(artefacts));
                g.GetComponent <RawImage>().texture  = sprite;
                g.GetComponent <RawImage>().material = null;
            }
        }
    }
Exemple #5
0
 /**
  * @Description geteur de l'artefact pour l'update
  * */
 public void setArtefacts(Artefacts.ArtefactsName artefacts)
 {
     this.artefacts = artefacts;
 }
Exemple #6
0
 // second constructeur pour set autre chose que l'heliort.
 public Zone(Etat.EtatName etat, Position position, Artefacts.ArtefactsName artefacts) : this(etat, position, artefacts, false)
 {
 }