public void AllerRetour() { switch (etatActuel) { case Etat.AttenteAller: if (activated) { etatActuel = Etat.Aller; activated = false; } break; case Etat.Aller: DeplacementAller(); break; case Etat.AttenteRetour: if (!timerActivated) { Invoke("StartReturning", timer); timerActivated = true; } break; case Etat.Retour: DeplacementRetour(); break; } }
void ApplyInputCoup(MyInput input) { switch (input.GetCoup()) { case MyInput.Coup.NOTHING: etat = Etat.IDLE; break; case MyInput.Coup.PUNCH: etat = Etat.PUNCH_START; break; case MyInput.Coup.KICK: etat = Etat.KICK_START; break; case MyInput.Coup.UPPERCUT: etat = Etat.UPPERCUT_START; break; case MyInput.Coup.PROTECT: etat = Etat.PROTECT; break; } }
private void Arkanoid_KeyDown(object sender, KeyEventArgs e) { // si on presse la barre d'espace quand le jeu se relance if (e.KeyCode == Keys.Space && etat_du_jeu==Etat.RELANCE) { etat_du_jeu = Etat.JOUE; timer1.Enabled = true; } // si on presse la touche p on gère la pause/reprise du jeu ( pour decommenter retirez "/* et */" ) if (e.KeyCode == Keys.P && etat_du_jeu == Etat.JOUE) { etat_du_jeu = Etat.ATTENTE; } else if (e.KeyCode == Keys.P && etat_du_jeu == Etat.RELANCE) { etat_du_jeu = Etat.JOUE; } // si on presse F2 pour pour démarrer la partie if (e.KeyCode == Keys.F2) { instruction.Location = new Point(1000, 1000); demarrerJeu(); } }
/***************************************************************************/ /* Nom: Constructeur par parametre */ /* Description: Cette fonction cree un etudiant et initialise ses */ /* parametres aux valeurs entrees en parametre */ /* Parametres: sprite (IN): Texture2D du sprite du bouton */ /* positionX (IN): float de la position en X du bouton */ /* positionY (IN): float de la position en Y du bouton */ /* Valeur de retour: Aucune */ /* Remarque: Ce constructeur initialise un bouton possedant un sprite, */ /* une fenetre et une position en X et en Y. */ /***************************************************************************/ public Bouton(Texture2D spriteNormal, Texture2D spriteHighlighted, Texture2D spriteActivated, float positionX, float positionY) { boutons = new List<Texture2D>{spriteNormal, spriteHighlighted, spriteActivated}; setPosition(positionX, positionY); etatPresent = Etat.Normal; bound = new Rectangle((int)positionX, (int)positionY, spriteNormal.Width, spriteNormal.Height); }
public ActionResult Plannifier(int?Id2, int EtatId) { var DisciplineId = (int)System.Web.HttpContext.Current.Session["disciplineid"]; Etat etat = _dbContext.Etats.SingleOrDefault(e => e.Id == EtatId); var Discipline = _dbContext.Disciplines.SingleOrDefault(c => c.Id == DisciplineId); var userSession = (Enseignant)Session["enseignant"]; var enseignant = _dbContext.Enseignants.SingleOrDefault(e => e.Id == userSession.Id); //creating evaluation EvaluationCollective evaluation = new EvaluationCollective(); if (etat.etat == false) { evaluation.SavoirFaire = etat.SavoireFaire; evaluation.Niveau = Discipline.Niveau; evaluation.Periode = etat.Periode; evaluation.date = DateTime.Now; evaluation.titre = Discipline.nomDiscipline; evaluation.domaine = etat.SavoireFaire.Competance.nomCompetance; _dbContext.Enseignants.SingleOrDefault(e => e.Id == userSession.Id).EvaluationCollectives.Add(evaluation); } etat.etat = !etat.etat; _dbContext.SaveChanges(); PlannifierEvalViewModel planVm = new PlannifierEvalViewModel(); planVm.Periodes = _dbContext.Periodes.ToList(); planVm.Competances = Discipline.Competances.ToList(); planVm.Etats = _dbContext.Etats.ToList(); return(Redirect("/Enseignant/Evaluations/Plannifier/" + DisciplineId)); }
public void EverythingGood(Etat etat) { if (etat == _etat) { _etat = Etat.None; } }
public Nuisible(string type, Position position, uint vitesse, Etat etat) { _type = type; _position = position; _vitesse = vitesse; _etat = etat; }
private void Terminate(bool error = false) { // Désctiver l'indexation pour éviter les serious error (http://forums.swr-productions.com/index.php?showtopic=5964) foreach (string path in Directory.GetFiles(_installPath, "*", SearchOption.AllDirectories)) { File.SetAttributes(path, FileAttributes.NotContentIndexed); } foreach (string path in Directory.GetDirectories(_installPath, "*", SearchOption.AllDirectories)) { File.SetAttributes(path, FileAttributes.NotContentIndexed); } // Fin _etat = Etat.Termine; if (error) { MessageBox.Show(string.Format("Echec du téléchargement de la mise à jour : vérifie ta connexion internet, essaie plus tard ou contacte Gregware.", Environment.NewLine), "Mise à jour échouée", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { labelPoint5.Visible = true; progressBar.Value = 1000; MessageBox.Show(string.Format("La mise à jour est un succès :-){0}{0}Merci d'avoir choisi Gregware.", Environment.NewLine), "Mise à jour terminée", MessageBoxButtons.OK, MessageBoxIcon.Information); } // Relancer le prog Process process = new Process(); process.StartInfo.FileName = _installPath + "\\GeneralsUltimateExperience.exe"; process.Start(); // Fermer celui là Close(); }
private void _timerDisplay_Tick(object sender, object e) { if (_points.Count() == 0) { DisplayMode = DisplayModeEnum.MODELE; _timerDisplay.Stop(); NavigateToFinish(); } else { CurrentExecutingProgram++; if (PointsToDisplay.Count() == 0) { _lastState = _points.Peek(); PointsToDisplay.Add(FabriqueVecteurWithState.CreateVecteur(_points.Dequeue())); } else { var _nextPoint = _points.Dequeue(); if (_lastState.Position != _nextPoint.Position && _lastState.Crayon == Etat.EtatCrayon.BAISSER) { PointsToDisplay.Add(FabriqueVecteurWithState.CreateVecteur(_lastState, _nextPoint)); } _lastState = _nextPoint; } Programme.RemoveAt(0); } }
/// <summary> /// Permet de notifier que l'état a changé /// </summary> /// <param name="etatFinal">l'état final du jeux</param> public void OnInstructionExecute(Etat etatFinal) { if (InstructionExecute != null) { InstructionExecute(this, new InstructionExecuteEventArgs(etatFinal)); } }
public async Task <IActionResult> Delete(int id) { if (ModelState.IsValid) { try { Etat _etat = _unitOfWork.Etat.GetSingleOrDefault(e => e.Id == id); if (_etat != null) { _unitOfWork.Etat.Remove(_etat); await _unitOfWork.SaveChangesAsync(); return(Ok("OK")); } else { return(BadRequest()); } } catch (Exception ex) { return(BadRequest(ex.Data)); } } else { return(BadRequest(ModelState)); } }
public async Task <IActionResult> Post([FromBody] EtatViewModel etat) { if (ModelState.IsValid) { try { Etat _etat = Mapper.Map <Etat>(etat); //_etat.Name = _etat.Name.ToUpper(); // _etat.ProcessId = etat.ProcessId; _etat.Process = _unitOfWork.Process.GetSingleOrDefault(e => e.Id == etat.ProcessId); _unitOfWork.Etat.Add(_etat); await _unitOfWork.SaveChangesAsync(); return(Ok("OK")); } catch (Exception ex) { return(BadRequest(ex.Data)); } } else { return(BadRequest(ModelState)); } }
public void LancerDe(int number) { switch (number) { case 1: if (EtatDe != De.Etat.Un) { EtatDe = De.Etat.Un; Refresh(); } break; case 2: if (EtatDe != De.Etat.Deux) { EtatDe = De.Etat.Deux; Refresh(); } break; case 3: if (EtatDe != De.Etat.Trois) { EtatDe = De.Etat.Trois; Refresh(); } break; } }
protected override Transition[] RecupererTransitionsSansSymbole( Etat etatSource) { try { var etatInfos = arbre .RecupererInfos(etatSource); if (null != etatInfos) { using (etatInfos.Lockeur.RecupererLockLecture()) { if (etatInfos.EstActif) { var transitionsSortantes = etatInfos .TransitionsSortantes; return(transitionsSortantes .RecupererTransitionsSansSymbole()); } } } return(new Transition[0]); } catch (Exception ex) { throw EncapsulerEtGererException <ExceptionTechniqueArbreConstruction>( ex); } }
public override Etat Suivant() { Automate_Poursuiveur automate = _automate as Automate_Poursuiveur; Etat res = this; //Si le gardien à le souafle if (Souafle.Possesseur != null) { Player possesseur = Souafle.Possesseur.GetComponent <Player>(); if (possesseur.Joueur.Poste == Poste.GARDIEN) { //Son gardien a le souafle if (possesseur.Joueur.Club == automate.Joueur.Joueur.Club) { res = new Etat_Poursuiveur_SeDemarquerGardien(automate); } } if (possesseur == automate.Joueur) { res = new Etat_Poursuivre_Avancer(automate); } } else { if (Math.Abs(Vector3.Distance(Souafle.Objet.transform.position, automate.Joueur.transform.position)) < 15) { res = new Etat_Poursuivreur_AllerVersSouafle(automate); } } return(res); }
public Transition[] AjouterChemin( Etat etatDebut, string chemin) { try { var transitions = new List <Transition>(); if (!string.IsNullOrEmpty(chemin)) { foreach (var symbole in chemin) { var etat = AjouterEtat(); var transition = AjouterTransition( etatDebut, etat, symbole); transitions .Add(transition); etatDebut = etat; } } return(transitions .ToArray()); } catch (Exception ex) { throw EncapsulerEtGererException <ExceptionTechniqueArbreConstruction>( ex); } }
// Use this for initialization void Start() { CurrentState = TabState.Length - 1; currentPV = PVMAX; statePV = (PVMAX - PVLastState); nbPVForState = statePV / TabState.Length; this.GetComponent <SpriteRenderer>().sprite = TabState[CurrentState]; // Ground truth values /*m_widthSmashBoxCollider = new float[]{1.6f, 2.45f, 3.14f, 3.82f, 4.4f}; * m_xOffSmashBoxCollider = new float[]{-0.2f, -0.25f, -0.25f, -0.25f, -0.25f}; * m_xSharpBoxCollider = new float[]{0.8f, 1.25f, 1.55f, 1.88f, 2.2f};*/ m_widthSmashBoxCollider = new float[] { 1.9f, 2.6f, 3.50f, 4.00f, 4.8f }; m_xOffSmashBoxCollider = new float[] { -0.08f, -0.08f, -0.08f, -0.16f, -0.01f }; m_xSharpBoxCollider = new float[] { 0.8f, 1.25f, 1.55f, 1.88f, 2.2f }; smashBox = this.GetComponent <BoxCollider2D> (); sharpBox = this.GetComponentsInChildren <BoxCollider2D> ()[1]; smashBox.size = new Vector2(m_widthSmashBoxCollider[CurrentState + 1], smashBox.size.y); smashBox.offset = new Vector2(m_xOffSmashBoxCollider[CurrentState + 1], smashBox.offset.y); sharpBox.transform.localPosition = new Vector3( m_xSharpBoxCollider[CurrentState + 1], sharpBox.transform.localPosition.y, sharpBox.transform.localPosition.z); widthBaseSmashBoxCollider = smashBox.size.x; xBaseSharpBoxCollider = sharpBox.transform.localPosition.x; previousXSharpBoxCollider = xBaseSharpBoxCollider; currentEtat = Etat.isOnTheFloor; }
// Start is called before the first frame update public void Initialisation() { listeEtat = new Etat[largeurGrille, longueurGrille]; for (int i = 0; i < longueurGrille; i++) { for (int j = 0; j < largeurGrille; j++) { if (i == largeurGrille - 1 && j == longueurGrille - 1) { listeEtat[i, j] = new Etat(j, i, true); } else { listeEtat[i, j] = new Etat(j, i, false); } } } foreach (Vector2 coordonnee in coordonneePiege) { listeEtat[(int)coordonnee.x, (int)coordonnee.y].value = -1500; etatsPieges.Add(listeEtat[(int)coordonnee.x, (int)coordonnee.y]); } }
public Transition AjouterTransition(Etat etatAvecReflexion) { return(AjouterTransition( etatAvecReflexion, etatAvecReflexion, null)); }
// Définie le type d'interraction suivant les Nuisibles qui se rencontres public void interagitAvec(Nuisible nuisible) { // Si le Nuisible est mort, il n'y a aucune interraction if (nuisible._etat == Etat.Mort || _etat == Etat.Mort) { return; } // Si le Nuisible est un Zombie, il transforme le Nuisible rencontré if (_etat == Etat.Zombie) { nuisible._etat = Etat.Zombie; nuisible._vitesse = Zombie.Vitesse; } // Si le nuisible est un Pigeon mutant, tue obligatoirement le Rat else if (nuisible._etat != Etat.Zombie && this.GetType() != nuisible.GetType() && nuisible.GetType() != typeof(Pigeon) && this.GetType() == typeof(PigeonMutant)) { nuisible._etat = Etat.Mort; } // Si le Nuisible est un Rat ou un Pigeon, tue aléatoirement un des deux Nuisibles else if (nuisible._etat != Etat.Zombie && this.GetType() != nuisible.GetType() && nuisible.GetType() != typeof(PigeonMutant) && this.GetType() != typeof(PigeonMutant)) { Random aleatoire = new Random(); if (aleatoire.Next(0, 2) == 0) { nuisible._etat = Etat.Mort; } else { this._etat = Etat.Mort; } } }
public void AjouterEtatBuses(Etat e) { var buses = ""; for (int j = 0; j < 33; j++) { buses = buses + "'" + e.Buses.ElementAt(j).Quantite + "',"; } var test = "INSERT INTO [dbo].[nouveau_etat]([UF],[Jour],[TB1],[TB2],[TB3],[TB4],[TB5],[TB6],[TB7],[TB8],[TB9],[TB10],[TB11],[TB12],[TB13],[TB14],[TB15],[TB16],[TB17],[TB18],[TB19],[TB20],[TB21],[TB22],[TB23],[TB24],[TB25],[TB26],[TB27],[TB28],[TB29],[TB30],[TB31],[TB32],[TB33],[equipe],[Technicin],[date],[type]) VALUES('" + e.UF + "','" + e.DateCS + "'," + buses + e.NumEquipe + ",'" + e.Technicien.Nom + "','" + e.DateCS + "','b');"; try { SqlConnection conn = new SqlConnection(global::feeder.Properties.Settings.Default.connn); conn.Open(); SqlCommand cmd = new SqlCommand(string.Format(test), conn); cmd.ExecuteNonQuery(); conn.Close(); MessageBox.Show("l'ajout état de buse est fait avec succés"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void FormUpdate_Shown(object sender, EventArgs e) { // Récupérer que les éléments utile de la liste _updateListeUtile = _remoteUpdateList.Where( u => u.Version.Major > _localVersion.Major || (u.Version.Major == _localVersion.Major && u.Version.Minor > _localVersion.Minor)).OrderBy( u => u.Version.Major).ThenBy( u => u.Version.Minor).ToList(); _nbUpdates = _updateListeUtile.Count(); if (_nbUpdates <= 0) { MessageBox.Show("Tu as déjà la version la plus récente", "Mise à jour annulée", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } // Obtenir l'espace requis long totalsize = _updateListeUtile.Sum(u => u.Size); // Vérifier l'espace disponible long freeSpace = new DriveInfo(new FileInfo(_installPath).Directory.Root.FullName).AvailableFreeSpace; if (freeSpace < totalsize + SIZE_MARGE) { MessageBox.Show(string.Format("Pas assez d'espace disponible. Un minimum de {0} Go est requis.", (totalsize + SIZE_MARGE) >> 30), "Mise à jour annulée", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } // Appliquer le(s) mise(s) à jour _etat = Etat.EnCours; RunNextUpdate(); }
public void boire(potion potion) { if (potion.Effet == Effet.poison) { this.pointsDeVie = this.pointsDeVie - potion.NombrePointVie; this.etat = Etat.empoisonné; if (this.pointsDeVie < 0) { this.pointsDeVie = 0; } Console.WriteLine("{0} boit une potion {1}", this.nom, potion.Effet); } if (potion.Effet == Effet.neutre) { this.pointsDeVie = this.pointsDeVie + potion.NombrePointVie; if (this.pointsDeVie > this.pointsDeVieMaximum) { this.pointsDeVie = this.pointsDeVieMaximum; } Console.WriteLine("{0} boit une potion {1}", this.nom, potion.Effet); } if (potion.Effet == Effet.antipoison) { this.pointsDeVie = this.pointsDeVie + potion.NombrePointVie; this.etat = Etat.ok; if (this.pointsDeVie > this.pointsDeVieMaximum) { this.pointsDeVie = this.pointsDeVieMaximum; } Console.WriteLine("{0} boit une potion {1}", this.nom, potion.Effet); } }
public override Etat Suivant() { Automate_Poursuiveur automate = base._automate as Automate_Poursuiveur; Etat res = this; //Si le gardien à le souafle if (Souafle.Possesseur != null) { Player possesseur = Souafle.Possesseur.GetComponent <Player>(); if (possesseur.Joueur.Poste == Poste.GARDIEN) { //Son gardien a le souafle if (possesseur.Joueur.Club == automate.Joueur.Joueur.Club) { res = new Etat_Poursuiveur_SeDemarquerGardien(automate); } //Le gardien adverse a le souafle else { res = new Etat_Poursuiveur_Marquage(automate); } } } //S'il n'a plus le ballon if (Souafle.Objet.transform.parent != automate.Joueur.transform) { res = new Etat_Poursuivreur_AllerVersSouafle(automate); } return(res); }
public ActionResult AjouterSavoir(SavoirFaire savoir, int compId) { ViewBag.Competance = _dbContext.Competances.SingleOrDefault(c => c.Id == compId); var competance = _dbContext.Competances.SingleOrDefault(c => c.Id == compId); if (ModelState.IsValid) { //adding "savoirfaire" if (_dbContext.Competances.SingleOrDefault(c => c.Id == compId).SavoirFaires.Any(sf => sf.nomSavoir.Equals(savoir.nomSavoir, StringComparison.InvariantCultureIgnoreCase))) { ModelState.AddModelError("Erreur_nomSavoir", "Ce savoir éxiste déja dans cette compétance"); return(View()); } else { _dbContext.Competances.SingleOrDefault(c => c.Id == compId).SavoirFaires.Add(savoir); } //adding "etats" for the new "savoirfaire" List <Periode> periodes = _dbContext.Periodes.ToList(); List <Etat> etats = new List <Etat>(); foreach (var periode in periodes) { Etat et = new Etat() { Periode = periode, SavoireFaire = savoir }; _dbContext.Etats.Add(et); } _dbContext.SaveChanges(); } return(View()); }
public void AllerSimple() { switch (etatActuel) { case Etat.AttenteAller: if (activated) { etatActuel = Etat.Aller; activated = false; } break; case Etat.Aller: DeplacementAller(); break; case Etat.AttenteRetour: if (reactivable && activated) { etatActuel = Etat.Retour; activated = false; } break; case Etat.Retour: DeplacementRetour(); break; } }
void ouverture() { etat = Etat.enOuverture; boiteDialogue.gameObject.SetActive(true); texteBoiteDialogue.text = ""; timer_boite = 0; }
public long Analyse() { m_Etat = Etat.EnCours; EtatModifier?.Invoke(this, EtatEngin); m_bgwAnalyse.RunWorkerAsync(); return(0); }
public override Etat Suivant() { Automate_Poursuiveur automate = _automate as Automate_Poursuiveur; Etat res = this; if (Souafle.Possesseur == null) { if (Math.Abs(Vector3.Distance(Souafle.Objet.transform.position, automate.Joueur.transform.position)) < 10) { res = new Etat_Poursuivreur_AllerVersSouafle(automate); } } else { Player p = Souafle.Possesseur.GetComponent <Player>(); if (p.Joueur.Poste != Poste.GARDIEN && p.Joueur.Club == automate.Joueur.Joueur.Club) { res = new Etat_Poursuiveur_SeDemarquer(automate); } if (p == automate.Joueur) { res = new Etat_Poursuivre_Avancer(automate); } } return(res); }
public void Action() { if (_courant != null) { _courant.Action(); _courant = _courant.Suivant(); } }
private void cbEtat_SelectedIndexChanged_1(object sender, EventArgs e) { //affectation à l'objet un Etat de l'enregistrement selectionner dans la zone de liste cbEtat unEtat = (Etat)this.cbEtat.SelectedItem; //recap ID ETAT textBox_recap_idEtat.Text = Convert.ToString(unEtat.id); }
/// <summary> /// Constructeur pour créer un rhinocéros /// </summary> /// <param name="X"></param> /// <param name="Y"></param> /// <param name="genre"></param> /// <param name="vieillesse"></param> /// <param name="etat"></param> /// <param name="tab"></param> /// <param name="type"></param> /// <param name="listeAnimal"></param> /// <param name="Hero"></param> public Rhino(int X, int Y, Genre genre, Vieillesse vieillesse, Etat etat, Bitmap[,] tab, TypeAnimal type, List <Animal> listeAnimal, Hero Hero) : base(X, Y, Genre.Male, Vieillesse.Adulte, Etat.Nourrit, tab, TypeAnimal.Rhino, listeAnimal, Hero) { _etat = etat; _genre = genre; _vieillesse = vieillesse; _type = type; tabTypeAnimal = DeterminerAnimal(TypeAnimal.Rhino); }
public void pick() { Debug.Log ("PICCCCKKKKKK"); this.GetComponent<FollowingGroundSpeed>().enabled = false; GameObject.FindGameObjectWithTag ("GripTree").GetComponent<BoxCollider2D> ().enabled = false; xPickUp = this.transform.position.x; this.transform.position = new Vector3(this.transform.position.x,yPickUp,this.transform.position.z); currentEtat = Etat.idle; m_lastHalfWidth = TabState[CurrentState].rect.width/2; }
public void Update(KeyboardState kState, MouseState mState) { if (bound.Contains(mState.X, mState.Y)) { if (mState.LeftButton == ButtonState.Pressed) etatPresent = Etat.Activated; else if (etatPresent == Etat.Activated && Clicked != null) Clicked(this, EventArgs.Empty); else etatPresent = Etat.Highlighted; } else etatPresent = Etat.Normal; }
bool matchNul; // True en cas de match nul #endregion Fields #region Constructors // Construit le plateau public MyPlateau(Joueur joueur1, Joueur joueur2) { //nbLignes = 6; //nbColonnes = 7; // Crée un tableau de 6 lignes, 7 colonnes lesCases = new Case[nbLignes, nbColonnes]; // Alloue le tableau for (int i = 0; i < nbLignes; i++) for (int j = 0; j < nbColonnes; j++) lesCases[i, j] = new Case(); // Initialise les joueurs this.joueur1 = joueur1; this.joueur2 = joueur2; etatPlateau = Etat.NonCommence; matchNul = false; }
private void Arkanoid_KeyDown(object sender, KeyEventArgs e) { // si on presse la barre d'espace quand le jeu se relance if (e.KeyCode == Keys.Space && etat_du_jeu==Etat.RELANCE) { etat_du_jeu = Etat.JOUE; timer1.Enabled = true; } // si on presse F2 pour pour démarrer la partie if (e.KeyCode == Keys.F2) { instruction.Location = new Point(1000, 1000); demarrerJeu(); } if (e.KeyCode == Keys.P && etat_du_jeu == Etat.JOUE) appelPause(etat_du_jeu, e); else if (e.KeyCode == Keys.P && etat_du_jeu == Etat.RELANCE) appelReprendre(etat_du_jeu, e); }
public void Smash() { smashNextTime = false; prepareNextTime = false; smashBox.enabled = true; sharpBox.enabled = false; currentEtat = Etat.isSmashing; currentTimeAnim = secondeSmash; prepareNextTime = false; }
// Cette action permet d'afficher ce qu'il faut lorsque la partie est finie public void finDePartie() { if (vies_joueur == 0) { etat_du_jeu = Etat.PERDU; } if (nb_blocs_touches == nb_blocs) { etat_du_jeu = Etat.GAGNE; } if (etat_du_jeu == Etat.PERDU) { this.etat_label.Visible = false; this.fin_label.Visible = true; this.fin_label.Text = "game over"; this.victoire_label.Visible = true; this.victoire_label.Text = "you don't know the power \n of the darkside"; this.instructions_label.Text = "press space to replay"; } if (etat_du_jeu == Etat.GAGNE) { this.etat_label.Visible = false; this.victoire_label.Visible = true; this.victoire_label.Text = "the force is strong with you"; this.instructions_label.Text = "press space to replay"; } }
// Use this for initialization void Start() { CurrentState = TabState.Length-1; currentPV = PVMAX; statePV = (PVMAX - PVLastState); nbPVForState = statePV / TabState.Length; this.GetComponent<SpriteRenderer>().sprite = TabState[CurrentState]; // Ground truth values /*m_widthSmashBoxCollider = new float[]{1.6f, 2.45f, 3.14f, 3.82f, 4.4f}; m_xOffSmashBoxCollider = new float[]{-0.2f, -0.25f, -0.25f, -0.25f, -0.25f}; m_xSharpBoxCollider = new float[]{0.8f, 1.25f, 1.55f, 1.88f, 2.2f};*/ m_widthSmashBoxCollider = new float[]{1.9f, 2.6f, 3.50f, 4.00f, 4.8f}; m_xOffSmashBoxCollider = new float[]{-0.08f, -0.08f, -0.08f, -0.16f, -0.01f}; m_xSharpBoxCollider = new float[]{0.8f, 1.25f, 1.55f, 1.88f, 2.2f}; smashBox = this.GetComponent<BoxCollider2D> (); sharpBox = this.GetComponentsInChildren<BoxCollider2D> ()[1]; smashBox.size = new Vector2(m_widthSmashBoxCollider[CurrentState+1], smashBox.size.y); smashBox.offset = new Vector2(m_xOffSmashBoxCollider[CurrentState+1], smashBox.offset.y); sharpBox.transform.localPosition = new Vector3( m_xSharpBoxCollider[CurrentState+1], sharpBox.transform.localPosition.y, sharpBox.transform.localPosition.z); widthBaseSmashBoxCollider = smashBox.size.x; xBaseSharpBoxCollider = sharpBox.transform.localPosition.x; previousXSharpBoxCollider = xBaseSharpBoxCollider; currentEtat = Etat.isOnTheFloor; }
public void smashHitTheGround() { smashNextTime = false; sharpBox.enabled = true; //smashBox.enabled = false; currentEtat = Etat.idle; AudioManager audioMan = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManager>(); audioMan.Play ("tree_smash"); GameObject.FindGameObjectWithTag ("CameraManager").GetComponent<CameraManager> ().setShaking(true,true,0.2f); GameObject.FindGameObjectWithTag ("BeaversManager").GetComponent<BeaversManager> ().SmashBeaversHangOnTree (); }
// Cette action permet de savoir si la (ou les) balle(s) est (sont) sortie(s) public void sortieDeBalle() { if (bonus == Bonus.MULTIBALLES) { if (balle.sortie() && balle2.sortie() && balle3.sortie()) { etat_du_jeu = Etat.PAUSE; balle.initialisation(); vies_joueur--; bonus = Bonus.RIEN; bonus_activation = false; balle2.Visible = false; balle3.Visible = false; miseEnPlaceDuMultiBalles(); } } else if (balle.sortie()) { etat_du_jeu = Etat.PAUSE; balle.initialisation(); vies_joueur--; } }
// Update is called once per frame void Update() { if (currentEtat == Etat.idle && smashBox != null && sharpBox !=null ) { smashBox.size = new Vector2(m_widthSmashBoxCollider[CurrentState+1], smashBox.size.y); smashBox.offset = new Vector2(m_xOffSmashBoxCollider[CurrentState+1], smashBox.offset.y); sharpBox.transform.localPosition = new Vector3( m_xSharpBoxCollider[CurrentState+1], sharpBox.transform.localPosition.y, sharpBox.transform.localPosition.z); if (this.GetComponent<SpriteRenderer>().sprite != finalSprite) { xPickUp = this.transform.position.x - (m_lastHalfWidth-TabState[CurrentState].rect.width/2)/100; this.transform.position = new Vector3(xPickUp, this.transform.position.y, this.transform.position.z); m_lastHalfWidth = TabState[CurrentState].rect.width/2; } else { xPickUp = this.transform.position.x - (m_lastHalfWidth-finalSprite.rect.width/2)/100; this.transform.position = new Vector3(xPickUp, this.transform.position.y, this.transform.position.z); m_lastHalfWidth = finalSprite.rect.width/2; } } if (currentEtat == Etat.isOnTheFloor) { this.GetComponent<FollowingGroundSpeed>().enabled = true; } if (currentEtat == Etat.waitForSmashing && smashNextTime) { Smash (); } if (currentEtat == Etat.idle && prepareNextTime) { prepareSmash (); } if (currentEtat == Etat.idle && throwItNextTime) { currentEtat = Etat.isThrown; } if (currentEtat == Etat.isSmashing) { if (setAngleTo(onTheGroundAngle -smashAngle,secondeSmash)){ this.transform.localEulerAngles = new Vector3(0,0,onTheGroundAngle) ; this.transform.position = new Vector3(xPickUp,yPickUp,this.transform.position.z); smashHitTheGround(); } } if (currentEtat == Etat.prepareSmash) { if(setAngleTo(smashAngle,secondePrepareSmash)){ this.transform.localEulerAngles = new Vector3(0,0,smashAngle) ; currentEtat = Etat.waitForSmashing; } } if (currentEtat == Etat.isThrown) { // throw the tree :D hell yeah ! smashBox.enabled = true; sharpBox.enabled = false; if(throwCurrentTime<throwDuration) { float y=0.2f*Mathf.Sin ((throwCurrentTime/throwDuration)*(Mathf.PI+0.2f)) + yPickUp ; transform.position = new Vector3(transform.position.x+0.03f, y, 0.0f); print ("throw "+throwCurrentTime+" < "+throwDuration); throwCurrentTime += Time.deltaTime; }else{ throwCurrentTime = 0.0f; currentEtat = Etat.throwFinish; throwItNextTime = false; smashBox.enabled = false; sharpBox.enabled = true; } } }
//On a cliqué sur "pause" private void appelPause(object sender, EventArgs e) { this.timer1.Stop(); this.etat_du_jeu = Etat.RELANCE; }
public void prepareSmash() { //smashBox.enabled = false; currentTimeAnim = secondePrepareSmash; currentEtat = Etat.prepareSmash; }
public Point ajouterPion(Joueur unJoueur, int numeroColonne) { int i; Point positionPion; // Si l'état n'est pas en cours if (etatPlateau == Etat.NonCommence) // Met en état en cours etatPlateau = Etat.EnCours; // Vérifie si la colonne n'est pas pleine if (lesCases[nbLignes - 1, numeroColonne - 1].isOccupe) { // La colonne est pleine, on ne fait rien // Retourne null positionPion = new Point(0, 0); return positionPion; } else { // la colonne n'est pas pleine for (i = 0; lesCases[i, numeroColonne - 1].isOccupe; i++) { } // On regarde jusqu'où la colonne est remplie Console.WriteLine("Numero de ligne :{0} ", i); // On ajoute le pion lesCases[i, numeroColonne - 1].occuperCase(unJoueur); } // Retourne la position du pion positionPion = new Point(i + 1, numeroColonne); return positionPion; }
//Cette action permet de détecter les événements clavier private void TheForceBreakout_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { etat_du_jeu = Etat.PAUSE; } if (e.KeyCode == Keys.Enter && etat_du_jeu != Etat.PERDU) { etat_du_jeu = Etat.JOUE; } if (e.KeyCode == Keys.Space && (etat_du_jeu == Etat.PERDU || etat_du_jeu == Etat.GAGNE)) { balle.initialisation(); barre.initialisation(); reinitialisation(); miseEnPlaceDesCouleurs(); vies_joueur = Constantes.NB_VIES; score = 0; this.fin_label.Visible = false; this.victoire_label.Visible = false; etat_du_jeu = Etat.JOUE; } if (e.KeyCode == Keys.M) { if (bonus_activation == false) { bonus = Bonus.MULTIBALLES; bonus_activation = true; } } }
public Organisation(string nom, Etat etat = Etat.NonDefini) { Nom = nom; Etat = etat; }
public Session setEtat(Etat etat) { String name = "public"; if (!OperationContext.Current.ServiceSecurityContext.IsAnonymous) name = Text.Sanitizer.SanitizeFileName(OperationContext.Current.ServiceSecurityContext.WindowsIdentity.Name); foreach (Session s in _sessions) { if(s.WindowsIdentityName.Equals(name)) { s.CurrentEtat = etat; return s; } } return null; }
// Cette action permet de détecter le click de la souris et de commencer ainsi la partie private void TheForceBreakout_MouseClick(object sender, MouseEventArgs e) { if (etat_du_jeu == Etat.PAUSE) etat_du_jeu = Etat.JOUE; }
// Verification de tous les évenements possibles à chaque fin de temps donnée ( les Ticks ) private void timer1_Tick(object sender, EventArgs e) { // Dans tous les cas possibles, la balle est en mouvement balle.bouger(); #region block touché par la balle // On parcourt tous les blocks contenue dans le tableau pour connaitre ceux touché par la balle for (int i = 0; i < 10; i++) for (int j = 0; j < 5; j++) { if (!balle.toucheBl)//la balle ne peut toucher qu'un bloc par tour { bool haut = false, bas = false, droite = false, gauche = false;// on détermine si le block à des blocks voisins if (i > 0) if (blocks[i - 1][j].Visible) gauche = true; if (i < 9) if (blocks[i + 1][j].Visible) droite = true; if (j > 0) if (blocks[i][j - 1].Visible) haut = true; if (j < 4) if (blocks[i][j + 1].Visible) bas = true; score += balle.toucheBlock(blocks[i][j], haut, bas, gauche, droite); // fonction qui retourne le nombre de point gagné si le block est touché, 0 sinon } } balle.toucheBl = false;// fin de la phase de collision, toucheBl est réinitialisé pour le prochain tour txtscore.Text = ("Score : " + score); // mise a jours de l'affichage du score #endregion #region colision de la balle avec les autres element if (balle.toucheFenetre(this.Size.Width, this.Size.Height) == Balle.TOUCHE_BAS) { timer1.Enabled = false; if (nbr_vie > 0)//reste-t-il des vies au joueur ? { perdreVie(); // emplacement de la balle au demarage this.balle.Location = new Point(150, 450); etat_du_jeu = Etat.RELANCE; } else { perdu(); this.Dispose(true); } } // on vérifie si la balle a touché la barre // la méthode ajuste les prochains déplacements balle.toucheBarre(this.barre); // voir class : "Balle.cs" #endregion #region verification de fin de jeu bool fini = true; // On vérifie si tous les block sont détruits foreach(Block[] ligne in blocks) foreach(Block colonne in ligne) { if (colonne.Visible == true)//Si un block est visible(donc restant), alors la partie continue. { fini = false; break; } } if (fini)//si il ne reste aucun block, alors on affiche les événements de victoire { this.timer1.Stop(); MessageBox.Show("Bravo !"); this.Dispose(true); } #endregion }
private void appelReprendre(object sender, EventArgs e) { this.timer1.Start(); this.etat_du_jeu = Etat.JOUE; }
//démmarre une nouvelle partie private void demarrerJeu() { switch (etat_du_jeu) { case Etat.ATTENTE: { this.timer1.Start(); this.etat_du_jeu = Etat.JOUE; break; } case Etat.RELANCE: { this.timer1.Start(); break; } } }
/// <summary> /// Un squelette de constructeur permettant de créer un héro ou un ennemi /// </summary> /// <param name="Nom">Nom du personnage</param> /// <param name="Classe">Classe du personnage</param> /// <param name="Etat">État de conscience actuel</param> /// <param name="Niveau">Niveau d'expérience</param> /// <param name="PointsDeVie">Nombre de points de vie actuel</param> /// <param name="PointsDeVieBase">Nombre de points de vie maximal</param> public Personnage(string Nom, Classe Classe, Etat Etat, int Niveau, int PointsDeVie, Attributs Attributs) { _nom = Nom.TrimEnd(' '); _classe = Classe; _etat = Etat; _niveau = Niveau; _attributs = Attributs; _pointsDeVie = PointsDeVie; }