예제 #1
0
        private IEnumerator Move()
        {
            ele         = GO.GetComponent <Unite>();
            deplacement = ele.deplacement;
            mouvement   = ele.mouvement;

            if (deplacement != null)
            {
                if (deplacement.Count == 0)
                {
                    ele.deplacement = null;
                    mouvement       = 0;
                }
                else
                {
                    StartCoroutine("MoveTowards");
                }
            }
            else
            {
                int rand = UnityEngine.Random.Range(7, 19);

                if (ele.camp.Equals("Ours"))
                {
                    ele.deplacement = Niveau.boucle_path((int)this.gameObject.transform.position.x, (int)this.gameObject.transform.position.y, 50, rand);
                }
                else
                {
                    ele.deplacement = Niveau.boucle_path((int)this.gameObject.transform.position.x, (int)this.gameObject.transform.position.y, 2, rand);
                }
            }
            yield break;
        }
예제 #2
0
 protected override void FixedUpdate()
 {
     if (!Pause.isPaused)
     {
         if (compteur++ >= intervalle)
         {
             var nearbyEntitys = UnityEngine.Physics2D.OverlapCircleAll(transform.position, range);
             foreach (var entity in nearbyEntitys)
             {
                 Unite unit = entity.gameObject.GetComponent <Unite>();
                 if (unit != null)
                 {
                     if ((((targetType & TargetType.enemy) != 0 && unit.camp != camp) || ((targetType & TargetType.ally) != 0 && unit.camp == camp)))
                     {
                         unit.receiveDamages(damages, element);
                         foreach (Effect effect in effectsToApply)
                         {
                             unit.addEffect(effect);
                         }
                     }
                 }
             }
             compteur = 0;
         }
     }
 }
예제 #3
0
 public Thermometre(string id, Unite unite)
 {
     SensorID    = id;
     SensorUnity = unite;
     SensorValue = 0;
     typeCapteur = TypeCapteur.temperature;
 }
예제 #4
0
 public ActionResult Login(string phone, string pwd)
 {
     try
     {
         string temppwd = Unite.ToMD5New(pwd);
         var    user    = db.tb_userinfos.FirstOrDefault(s => s.Phone == phone && s.UsPwd == temppwd);
         if (user == null)
         {
             return(Json(Comm.ToJsonResult("Fail", "账号或密码错误"), JsonRequestBehavior.AllowGet));
         }
         else
         {
             var returndata = new
             {
                 guid     = user.UserID,
                 openid   = user.OpenID,
                 UsPID    = user.PID,
                 tbuserid = user.tbuserid
             };
             return(Json(Comm.ToJsonResult("Success", "成功", returndata), JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         return(Json(Comm.ToJsonResult("Error", ex.Message), JsonRequestBehavior.AllowGet));
     }
 }
예제 #5
0
        private void btnImpr1_Click(object sender, EventArgs e)
        {
            //try
            //{
            var convertisseur = ConvertisseurNombreEnLettre
                                .Parametrage
                                .AppliquerUneUnite(Unite.Creer("dirham", "dirhams", "centime", "Centimes"))
                                .ModifierLaVirgule("et ").AppliquerLaRegleDesTiretsDe1990(true)
                                .ValiderLeParametrage();

            var data = db.print_Fac(numfac, Cmbste.Text);
            var reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();

            reportDataSource1.Name  = "DataSet1";
            reportDataSource1.Value = data;

            ReportParameter[] parameters = new ReportParameter[3];
            parameters[0] = new ReportParameter("Montant", convertisseur.Convertir(Montant));
            parameters[1] = new ReportParameter("TVA", Tva.ToString());
            parameters[2] = new ReportParameter("TTC", Montant.ToString());


            this.reportViewer1.LocalReport.SetParameters(parameters);
            reportViewer1.LocalReport.DataSources.Clear();

            this.reportViewer1.LocalReport.Refresh();
            this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1);
            //this.reportViewer1.LocalReport.ReportEmbeddedResource = "GESTIONCOMMECIALE.Report1.rdlc";

            this.reportViewer1.RefreshReport();
            //}
            //catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
예제 #6
0
        // GET: Unites
        public ActionResult Index()
        {
            Unite unit = new Unite();

            unit.Units = db.Unites.ToList();
            return(View(unit));
        }
 public Hygrometre(string name, Unite unite)
 {
     SensorID    = name;
     SensorValue = 0;
     SensorUnity = unite;
     typeCapteur = TypeCapteur.humidite;
 }
예제 #8
0
    void OnEnable()
    {
        enemy = GetComponent <Unite>();

        target = Waypoints.points[0];

        wavePointIndex = 0;
    }
        public ActionResult DeleteConfirmed(int id)
        {
            Unite unite = db.Unites.Find(id);

            db.Unites.Remove(unite);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #10
0
 public void digere(Soldat ennemi)
 {
     enDigestion = ennemi;
     ennemi.transform.position = transform.position;
     ennemi.occupe             = true;
     ennemi.paralise           = true;
     stopTirs = true;
 }
예제 #11
0
 public TankHMI(Unite unite) : base(unite)
 {
     GhostImage = new Image
     {
         Source = new BitmapImage(new Uri(Environment.CurrentDirectory + "\\src\\files\\images\\sprites\\tank.png")),
         Height = Height,
         Width  = Width
     };
 }
예제 #12
0
 void attaque(Unite ennemi)
 {
     ennemi.degat(ennemi.element.lireRatioDegat(element) * effectivesDamages);
     if (sonCombat != null)
     {
         AudioSource.PlayClipAtPoint(sonCombat, Vector3.one, 1);
     }
     cooldown = tempsRecharge;
 }
 public WeatherLayerHMI(Unite unite) : base(unite)
 {
     GhostImage = new Image()
     {
         Source = new BitmapImage(new Uri(Environment.CurrentDirectory + "\\src\\files\\images\\sprites\\weather_layer.png")),
         Height = Height,
         Width  = Width,
     };
 }
예제 #14
0
 public ActionResult Edit([Bind(Include = "UnitId,Unit")] Unite unite)
 {
     if (ModelState.IsValid)
     {
         db.Entry(unite).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(unite));
 }
예제 #15
0
        public void PeutConvertirAvecUneUnitePersonnalisee()
        {
            var convertisseur = ConvertisseurNombreEnLettre.Parametrage
                                .AppliquerUneUnite(Unite.Creer("pouet", "pouets", "minipouet", "minipouets"))
                                .ModifierLaVirgule("et")
                                .ValiderLeParametrage();

            convertisseur.Convertir(1).Should().Be("un pouet");
            convertisseur.Convertir(42).Should().Be("quarante-deux pouets");
            convertisseur.Convertir(42.27m).Should().Be("quarante-deux pouets et vingt-sept minipouets");
        }
 public ActionResult Edit([Bind(Include = "Id,Name,SinifId")] Unite unite)
 {
     if (ModelState.IsValid)
     {
         db.Entry(unite).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SinifId = new SelectList(db.Sinifs, "Id", "Name", unite.SinifId);
     return(View(unite));
 }
예제 #17
0
        /// <summary>
        /// Rafraichissement de l'affichage des données pour une unité des ses caractéristiques
        /// </summary>
        ///  <param name="u"> L'unité choisit par l'utilisateur </param>
        public void changeListeViewUnite(Unite u)
        {
            infoUnite.Items.Clear();
            infoUnite.Items.Add(u.getPV());
            infoUnite.Items.Add(u.getAtt());
            infoUnite.Items.Add(u.getDef());
            List <UniteDeBase> listcase = MaPartie.LaCarte.getCase(u.getColumn(), u.getRow()).getUnitsOnCase();

            infoUnite.Items.Add(listcase.Count());
            infoUnite.Items.Refresh();
        }
예제 #18
0
        public ActionResult Create([Bind(Include = "UnitId,Unit")] Unite unite)
        {
            if (ModelState.IsValid)
            {
                db.Unites.Add(unite);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(unite));
        }
        public ActionResult Create([Bind(Include = "Id,Name,SinifId")] Unite unite)
        {
            if (ModelState.IsValid)
            {
                db.Unites.Add(unite);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.SinifId = new SelectList(db.Sinifs, "Id", "Name", unite.SinifId);
            return(View(unite));
        }
예제 #20
0
        /// <summary>
        /// 对URL进行替换
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string FormatUrl(string str)
        {
            string temptoken = GetToken();

            str = str.Replace("{IP}", Unite.GetClientIP());
            str = str.Replace("{Token}", temptoken);
            str = str.Replace("{Time}", GetTimeStamp().ToString());
            str = str.Replace("{Rand}", new Random().Next(100, 9999).ToString());
            str = str.Replace("{_Time}", (GetTimeStamp() - new Random().Next(5000, 25555)).ToString());
            str = str.Replace("{PvidTime}", (GetTimeStamp() - new Random().Next(5000, 25555)).ToString());
            return(str);
        }
예제 #21
0
        private void SupprimerUnite(object sender, RoutedEventArgs e)
        {
            Unite selection = (Unite)lvUnite.SelectedItem;

            if (selection != null)
            {
                if (MessageBox.Show($"Etes-vous sur de vouloir supprimer l'unité {selection.Nom} de la liste ?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    Statics.TryCatch(() => { _bdd.SupprimerUnite(selection); }, nameof(SupprimerUnite));
                }
            }
        }
예제 #22
0
 public Unite Update(Unite Unite)
 {
     try
     {
         _UniteRepository.Update(Unite);
         return(Unite);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #23
0
    // Use this for initialization
    override protected void Start()
    {
        base.Start();

        objectif                  = null;
        cible                     = null;
        hitPoints                 = maxHitPoints;
        spriteRenderer            = GetComponent <SpriteRenderer>();
        colorSpriteRenderer       = transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>();
        colorSpriteRenderer.color = element.couleur;
        cooldown                  = 0;
        enCombat                  = false;
    }
예제 #24
0
 public Unite Add(Unite Unite)
 {
     try
     {
         _context.Unites.Add(Unite);
         _context.SaveChanges();
         return(Unite);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #25
0
        public ActionResult <Unite> Put([FromBody] Unite Unite)
        {
            var res = _UniteService.Update(Unite);

            if (res is null)
            {
                return(BadRequest());
            }
            else
            {
                return(Unite);
            }
        }
예제 #26
0
        public Spaceship(Unite unite, MapHMI map) : base(unite)
        {
            MapHMI = map;
            Astronef u = (Astronef)Unite;

            _reserve   = new SpaceshipReserve(u.Reserve, this);
            GhostImage = new Image()
            {
                Source = new BitmapImage(new Uri(Environment.CurrentDirectory + "\\src\\files\\images\\sprites\\astronef.png")),
                Height = Height,
                Width  = Width,
            };
        }
        // GET: Unites/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Unite unite = db.Unites.Find(id);

            if (unite == null)
            {
                return(HttpNotFound());
            }
            return(View(unite));
        }
예제 #28
0
        public override bool Execute()
        {
            uni  = GO.GetComponent <Unite>();
            dist = new List <float>();

            foreach (KeyValuePair <float, Vector3> entry in uni.enn_pos)
            {
                dist.Add(entry.Key);
            }
            dist.Sort();

            StartCoroutine("Projectile");
            return(true);
        }
        // GET: Unites/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Unite unite = db.Unites.Find(id);

            if (unite == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SinifId = new SelectList(db.Sinifs, "Id", "Name", unite.SinifId);
            return(View(unite));
        }
예제 #30
0
        /// <summary>
        /// Fonction qui retourne une carte.
        /// </summary>
        /// <param name="query">Requête à effectuer sur la BD</param>
        /// <returns>Une carte avec son effet.</returns>
        private static Carte Retrieve(string query)
        {
            Carte     resultat;
            DataSet   dsResultat;
            DataTable dtResultat;
            DataRow   drResultat;

            ConnectionBD = new MySqlConnexion();

            dsResultat = ConnectionBD.Query(query);
            dtResultat = dsResultat.Tables[0];
            drResultat = dtResultat.Rows[0];
            Effet effetCarte = null;

            if (drResultat["idEffet"] != DBNull.Value)
            {
                effetCarte = MySqlEffetService.RetrieveById((int)drResultat["idEffet"]);
            }
            if (drResultat["typeUnite"] != DBNull.Value) // TODO: vérifié si le if fonctionne sinon changé pour "null"
            {
                resultat = new Unite((int)drResultat["idCarte"]
                                     , (string)drResultat["nom"]
                                     , effetCarte
                                     , new Ressource((int)drResultat["coutCharronite"], (int)drResultat["coutBarilNucleaire"], (int)drResultat["coutAlainDollars"])
                                     , (int)drResultat["pointsAttaque"]
                                     , (int)drResultat["pointsDefense"]
                                     );
            }
            else if (drResultat["pointsDefense"] != DBNull.Value) // TODO: vérifié si le if fonctionne sinon changé pour "null"
            {
                resultat = new Batiment((int)drResultat["idCarte"]
                                        , (string)drResultat["nom"]
                                        , effetCarte
                                        , new Ressource((int)drResultat["coutCharronite"], (int)drResultat["coutBarilNucleaire"], (int)drResultat["coutAlainDollars"])
                                        , (int)drResultat["pointsDefense"]
                                        );
            }
            else
            {
                resultat = new Gadget((int)drResultat["idCarte"]
                                      , (string)drResultat["nom"]
                                      , effetCarte
                                      , new Ressource((int)drResultat["coutCharronite"], (int)drResultat["coutBarilNucleaire"], (int)drResultat["coutAlainDollars"])
                                      );
            }

            return(resultat);
        }
예제 #31
0
    /**
     * Constructeur de la classe Partie
     * nomPartie Le nom de la partie
     * c La carte associee a la partie
     * joueurs Les joueurs deja initialises associes a leurs numeros respectifs
     * nbTours Le nombre de tour a realiser ou restant a la partie
     * joueurCourant Le joueur courant
     */
    public Partie(string nomPartie, Carte c, List<Joueur> joueurs, int nbTours)
    {
        this._carte = c;
        this._joueurs = joueurs;
        this._toursRestants = nbTours;
        this._nomPartie = nomPartie;

        // Selection de la premiere unite courante
        this._uniteCourante = this._joueurs[0].Peuple.Unites[0];

        // Mise a zero du compteur de joueurs
        this._cptTourJoueurs = 0;

        // Calcul des points de joueurs
        this.recalculerPoints();
        NBMAXJOUEURS = joueurs.Count;
        this._nbJoueursRestants = joueurs.Count;
        this.initUnites();
        this._carte.GrilleUnites = new Dictionary<Coordonnee,List<Unite>>();
        this.miseAJourGilleUnite();
        this.recalculerPoints();
    }
예제 #32
0
    public void Attaque(Direction dir)
    {
        // Verification de la validite du deplacement
        this.mouvementValide(dir);

        Coordonnee courante = this._uniteCourante.Coordonnees;
        Coordonnee cible = courante + dir;
        List<Unite> ciblee = unitesEnemiesSurCase(cible);
        // On vérifie que la liste ciblee n'est pas vide:
        if (ciblee.Count <= 0)
            throw new PartieException("Aucune unite cible sur la case séléctionnee");
        // On séléctionne la meilleure unité en défense
        Unite meilleurDef = null;
        int def = -1;
        foreach (Unite u in ciblee) {
            if (u.Defense > def)
                def = u.Defense;
            meilleurDef = u;
        }
        Joueur defenseur = trouverJoueur(meilleurDef.Joueur);
        try {
            if (this._uniteCourante.Attaquer(meilleurDef)) { // S'il y a victoire
                // On verifie si l'unite cible est morte

                if (meilleurDef.PointsDeVie <= 0) {
                    defenseur.Peuple.TuerUnite(meilleurDef);
                    this._carte.GrilleUnites[cible].Remove(meilleurDef);
                    ciblee.Remove(meilleurDef);
                    // S'il n'y a plus d'unites présentes sur la carte cible on effectue un déplacement
                    if (ciblee.Count <= 0)
                        this._uniteCourante.Deplacer(cible, this._carte.GetTypeCase(courante));
                    throw new UniteMorteException("", meilleurDef.Id, meilleurDef.Joueur);
                }
                throw new UniteGagnanteException("", this._joueurs[0].Id, defenseur.Id);
            } else { // S'il y a defaite
                // On verifie si l'unite courante est morte
                if (this._uniteCourante.PointsDeVie <= 0) {
                    this._joueurs[0].Peuple.TuerUnite(this._uniteCourante);
                    this._carte.GrilleUnites[courante].Remove(this._uniteCourante);
                    int keepUip = this._uniteCourante.Id;
                    if(this._joueurs[0].EnJeu)
                        this._uniteCourante = this._joueurs[0].Peuple.Unites[0];
                    throw new UniteMorteException("", keepUip, this._joueurs[0].Id);
                }
                throw new UniteGagnanteException("", defenseur.Id, this._joueurs[0].Id);
            }
        }
        catch (UniteMorteException ume) {
            throw ume;
        } catch (UniteGagnanteException uge) {
            throw uge;
        } finally {
            if (!defenseur.EnJeu) {
                this._joueurs.Remove(defenseur);
                this._nbJoueursRestants--;
                throw new PartieException("Le joueur " + defenseur.Id + " a perdu !","perdu");
            } else if(!_joueurs[0].EnJeu) {
                this._joueurs.Remove(this._joueurs[0]);
                this._nbJoueursRestants--;
                this.changerJoueur();
                throw new PartieException("Le joueur " + this._joueurs[0].Id + " a perdu !","perdu");
            }
        }
    }
예제 #33
0
    public void PasserTourUniteCourante()
    {
        // On recupere le numero de l'unite courante dans les unites du joueur
        IPeuple p = this._joueurs[0].Peuple;
        int id = p.Unites.IndexOf(this._uniteCourante);

        // Correspond à la place de l'unite courante dans la list Unites du peuple courant (numéroté de 0 à n-1)
        if (id < p.NombreUnites - 1)
            this._uniteCourante = p.Unites[id + 1];
        else
            this._uniteCourante = p.Unites[0];
    }
예제 #34
0
 public void Selectionner(Unite unite)
 {
     this._uniteCourante = unite;
 }
예제 #35
0
    /**
     * Methode permettant de changer de joueur et de recompter les points
     */
    private void changerJoueur()
    {
        // Recomptage des points des joueurs
        this.recalculerPoints();

        // Cas fin de partie par manque de tours
        if (this._toursRestants <= 0)
            throw new FinPartieException("il ne reste plus de tours à jouer");

        this._cptTourJoueurs++;

        // Cas fin de boucle
        if(this._cptTourJoueurs >= this._nbJoueursRestants) {
            this._cptTourJoueurs = 0;
            this._toursRestants--;
        }

        Joueur j = this._joueurs[0];
        // Suppression du joueur courant (t) de la file
        this._joueurs.Remove(j);
        // Ajout de l'ancien joueur courant en fin de file
        this._joueurs.Add(j);
        // Mise a jour de l'unite courante
        this._uniteCourante = this.Joueurs[0].Peuple.Unites[0];
    }
예제 #36
0
 /**
  * Methode permettant la suppression d'une unite dans la table des unites
  * et la mise a jour du compteur d'unites
  */
 public void TuerUnite(Unite unite)
 {
     this._unites.Remove(unite);
     this._nbUnites--;
 }
예제 #37
0
 // MORT
 public override List<Vector2> Mort(Unite unite)
 {
     return new List<Vector2> { new Vector2(5,0) };
 }