Example #1
0
 public frmPlateforme(Plateforme plat)
 {
     InitializeComponent();
     txtID.Enabled = false;
     txtID.Text = plat.idPlateforme.ToString();
     cmbTypePlateforme.Enabled = false;
     cmbTypePlateforme.Items.Add(plat.TypePlateforme.nomTypePlateforme);
     cmbTypePlateforme.SelectedIndex = 0;
     //cmbTypePlateforme.SelectedIndex = cmbTypePlateforme.Items.IndexOf(plat.TypePlateforme.nomTypePlateforme);
     cmbNom.Enabled = true;
     cmbNom.AllowDrop = false;
     cmbNom.Text = plat.nomPlateforme;
     rtbConfiguration.Text = plat.configPlateforme;
     rtbCommentaire.Text = plat.commPlateforme;
     //Probleme à discuter
     //SysExp SE = plat.SysExp.First();
     //cmbNomSE.Text = SE.nomSysExp;
     //EditionSysExp EditionSE = SE.EditionSysExp.First();
     //cmbEditionSE.Text = EditionSE.nomEdition;
     //VersionSysExp VersionSE = EditionSE.VersionSysExp.First();
     //cmbVersionSE.Text = VersionSE.noVersion;
     btnAjouter.Text = "Modifier";
     modif = true;
     platModif = plat;
 }
Example #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        // etape 1 : avancer jusqu'au milieu de la scene
        if (etat == 0)
        {
            Vector2 velocity = rb.velocity;
            velocity.x = moveSpeed;
            animator.SetFloat("hSpeed", Mathf.Abs(rb.velocity.x));
            rb.velocity = velocity;
        }
        // etape 3 : transformer le joueur en ame
        if (etat == 2)
        {
            etat = 3;
            ame.gameObject.SetActive(true);
            Invoke("kill", 1);
        }
        // etape 2 : stopper le joueur et passer en mode spirituel
        if (etat == 1)
        {
            // on stoppe le joueur
            Vector3 theScale = transform.localScale;
            theScale.x          *= -1;
            transform.localScale = theScale;
            animator.SetFloat("hSpeed", 0);
            etat = 2;
            // on passe en mode esprit
            isSpirit = !isSpirit;
            animator.SetBool("isSpirit", isSpirit);
            // on passe les elements de la scene en mode esprit
            int lengthPlateformes = level.plateformes.Length;
            int lengthBackground  = level.backgrounds.Length;

            Plateforme plateforme = (Plateforme)level.plateformes[0];
            plateforme.isSpirit = isSpirit;
            if (!(plateforme.statut == 0 || isSpirit && plateforme.statut == 2 || !isSpirit && plateforme.statut == 1))
            {
                for (int j = 0; j < plateforme.transform.childCount; j++)
                {
                    Transform objet = plateforme.transform.GetChild(j);
                    if (objet.name == "Player")
                    {
                        groundChecker.getTriggers().Clear();
                        objet.transform.parent = null;
                    }
                }
            }
            for (int i = 0; i < lengthBackground; i++)
            {
                backgroundAdapter back = (backgroundAdapter)level.backgrounds[i];
                back.changeUnivers(isSpirit);
            }
        }
    }
Example #3
0
 //public static void Ajouter(TypePlateforme _typePlateforme, string _nomPlateforme, string _configPlateforme, string _descPlateforme, string _sysExp)
 public static string CreerPlateforme(TypePlateforme _typePlateforme, string _nomPlateforme, string _configPlateforme, string _commPlateforme)
 {
     Plateforme plateforme = new Plateforme();
     plateforme.nomPlateforme = _nomPlateforme;
     plateforme.configPlateforme = _configPlateforme;
     plateforme.commPlateforme = _commPlateforme;
     plateforme.idTypePlateforme = _typePlateforme.idTypePlateforme;
     try
     {
         Enregistrer(plateforme);
         return "La plateforme a été ajoutée avec succès!";
     }
     catch (Exception)
     {
         return "Une erreur est survenue lors de l'ajout de la Plateforme. Les données n'ont pas été enregistrées.";
     }
 }
Example #4
0
 // SysExp et Plateforme existent, on veut seulement les associer
 public static string LierPlateformeSysExp(Plateforme _Plateforme, String _sysExp, string _nomPlateforme, string _configuration, string _comm)
 {
     Plateforme plat = _Plateforme;
     SysExp sysExp = context.tblSysExp.Where(x => x.nomSysExp == _sysExp).First();
     plat.SysExp.Add(sysExp);
     plat.nomPlateforme = _nomPlateforme;
     plat.commPlateforme = _comm;
     plat.configPlateforme = _configuration;
     try
     {
         context.SaveChanges();
         return "Une plateforme a été liée à un systeme d'exploitation!";
     }
     catch (Exception)
     {
         return "Une erreur est survenue lors de la liaison avec un Système d'Exploitation. Les données n'ont pas été enregistrées.";
     }
 }
Example #5
0
        public static string Ajouter(TypePlateforme _typePlateforme, string _nomPlateforme, string _configPlateforme, string _descPlateforme, string _sysExp)
        {
            Plateforme plateforme = new Plateforme();
            plateforme.nomPlateforme = _nomPlateforme;
            plateforme.configPlateforme = _configPlateforme;
            plateforme.commPlateforme = _descPlateforme;
            plateforme.idTypePlateforme = _typePlateforme.idTypePlateforme;

            SysExp sysExp = context.tblSysExp.Where(x => x.nomSysExp == _sysExp).First(); // On va chercher le  SysExp
            sysExp.nomSysExp = _sysExp;

            try
            {
                Enregistrer(plateforme, sysExp);
                return "La plateforme a été ajoutée et liée a un systeme d'exploitation avec succès!";
            }
            catch (Exception)
            {
                return "Une erreur est survenue lors de l'ajout de la Plateforme. Les données n'ont pas été enregistrées.";
            }
        }
Example #6
0
    /*************
    *  Buttons  *
    *************/
    public void GetInfos()
    {
        Plateforme = null;
        if (!System.Uri.TryCreate(URL.text, System.UriKind.Absolute, out var url))
        {
            StartCoroutine(Error("URL non valide")); return;
        }

        var plateformes = System.Reflection.Assembly.GetExecutingAssembly().GetTypes().Where(t => string.Equals(t.Namespace, "Plateformes", System.StringComparison.Ordinal));

        foreach (var plateforme in plateformes)
        {
            if ((bool)plateforme.GetMethod("CheckURL").Invoke(null, new object[] { url }))
            {
                Plateforme = (Plateforme)System.Activator.CreateInstance(plateforme, url);
                break;
            }
        }

        if (Plateforme == null)
        {
            StartCoroutine(Error("URL non reconnue")); return;
        }

        SetProgress(0);
        StartCoroutine(Plateforme.Infos((infos) =>
        {
            if (infos.Error)
            {
                StartCoroutine(Error("Une erreur inattendue est survenu")); return;
            }
            URL.text            = infos.URL;
            PageNumber.text     = infos.Page.ToString();
            PageSlider.maxValue = infos.Pages.Length;
            PageSlider.value    = infos.Page;
            Name.text           = $"<b>{infos.Plateforme}:</b> {infos.Name}";
            RefreshView();
            SetProgress(1);
        }));
    }
Example #7
0
 private static void Enregistrer(Plateforme _Plateforme)
 {
     context.tblPlateforme.Add(_Plateforme);
     context.SaveChanges();
 }
Example #8
0
        private static void Enregistrer(Plateforme _Plateforme, SysExp _sysExp)
        {
            context.tblPlateforme.Add(_Plateforme); // on enregistre la plateforme
            context.SaveChanges();

            _Plateforme.SysExp.Add(_sysExp); // lier le SysExp avec la plateforme
            context.SaveChanges();
        }
Example #9
0
 // Retourne la plateforme associer au nom
 public static string Modifier(string _nomPlateforme, string _configuration, string _comm, Plateforme _plat)
 {
     Plateforme plateforme = _plat;
     plateforme.nomPlateforme = _nomPlateforme;
     plateforme.configPlateforme = _configuration;
     plateforme.commPlateforme = _comm;
     try
     {
         context.SaveChanges();
         return "La plateforme a été modifiée avec succès!";
     }
     catch (Exception)
     {
         return "Une erreur est survenue lors de la modification de la Plateforme. Les données n'ont pas été enregistrées.";
     }
 }
Example #10
0
    // A l'initialisation, le monde est en mode physique, on passe tout
    // les objets de la scene en mode physique
    void Start()
    {
        isTimerOn    = false;
        isActivating = false;
        hasJumped    = false;
        period       = 0.1f;
        rb           = GetComponent <Rigidbody2D>();
        animator     = GetComponent <Animator>();

        //-	On recupere les tableaux des elements de notre GameObject Level.
        //-	Pour chaque tableau, on parcourt les elements
        //-	On recupere l’element, on change son attribut isSpirit.
        //-	On desactive l’element si c’est un element physique et qu’on est en mode esprit, ou si c’est
        //un element spirituel et qu’on est en mode physique. On active l’element sinon

        int lengthActionneurs = level.actionneurs.Length;
        int lengthEnnemis     = level.ennemis.Length;
        int lengthCadavres    = level.cadavres.Length;
        int lengthPlateformes = level.plateformes.Length;
        int lengthMurs        = level.murs.Length;
        int lengthBackground  = level.backgrounds.Length;

        Physics2D.IgnoreLayerCollision(9, 10);

        animator.SetBool("isSpirit", isSpirit);
        for (int i = 0; i < lengthActionneurs; i++)
        {
            Actionneur actionneur = (Actionneur)level.actionneurs[i];
            actionneur.isSpirit = isSpirit;
            actionneur.gameObject.SetActive(actionneur.statut == 0 || isSpirit && actionneur.statut == 2 || !isSpirit && actionneur.statut == 1);
        }
        for (int i = 0; i < lengthEnnemis; i++)
        {
            Ennemi ennemi = (Ennemi)level.ennemis[i];
            ennemi.isSpirit = isSpirit;
            ennemi.gameObject.SetActive(ennemi.statut == 0 || isSpirit && ennemi.statut == 2 || !isSpirit && ennemi.statut == 1);
        }
        for (int i = 0; i < lengthCadavres; i++)
        {
            Cadavre cadavre = (Cadavre)level.cadavres[i];
            cadavre.isSpirit = isSpirit;
            cadavre.gameObject.SetActive(cadavre.statut == 0 || isSpirit && cadavre.statut == 2 || !isSpirit && cadavre.statut == 1);
        }

        for (int i = 0; i < lengthPlateformes; i++)
        {
            Plateforme plateforme = (Plateforme)level.plateformes[i];
            plateforme.isSpirit = isSpirit;
            if (!(plateforme.statut == 0 || isSpirit && plateforme.statut == 2 || !isSpirit && plateforme.statut == 1))
            {
                for (int j = 0; j < plateforme.transform.childCount; j++)
                {
                    Transform objet = plateforme.transform.GetChild(j);
                    if (objet.name == "Player")
                    {
                        groundChecker.getTriggers().Clear();
                        objet.transform.parent = null;
                    }
                }
            }

            plateforme.gameObject.SetActive(plateforme.statut == 0 || isSpirit && plateforme.statut == 2 || !isSpirit && plateforme.statut == 1);
        }
        for (int i = 0; i < lengthMurs; i++)
        {
            Mur mur = (Mur)level.murs[i];
            mur.isSpirit = isSpirit;
            mur.gameObject.SetActive(mur.statut == 0 || isSpirit && mur.statut == 2 || !isSpirit && mur.statut == 1);
        }
        for (int i = 0; i < lengthBackground; i++)
        {
            backgroundAdapter back = (backgroundAdapter)level.backgrounds[i];
            back.changeUnivers(isSpirit);
        }
    }
Example #11
0
    // Update is called once per frame
    void Update()
    {
        // On ecrit le texte des ames et morts.
        setText();

        // Menu Pause
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale != 0)
            {
                pause();
            }
            else
            {
                reprendre();
            }
        }

        // Gere le changement de direction du joueur
        Flip();

        // On allour un temps entre chaque action du joueur pour eviter 2 actions consecutives non voulues
        if (isActivating)
        {
            timer        = Time.time;
            isActivating = false;
            isTimerOn    = true;
        }

        if (isTimerOn && Time.time > timer + period)
        {
            isTimerOn = false;
        }

        // Si le joueur peut sauter et qu'il veut sauter, il saute
        if ((rb.velocity.y == 0 || isGrounded) && Input.GetButtonDown("Jump"))
        {
            rb.isKinematic = false;
            animator.SetBool("isGround", false);
            rb.AddForce(new Vector2(0f, jumpSpeed), ForceMode2D.Impulse);
        }

        // Changement de vue
        //-	Verification de l’appui du bouton « touche haut » clavier.
        //-	Changement de l’attribut booleen isSpirit du player, correspondant au mode Physique ou Esprit.
        //-	Changement de l’animation du player.
        //-	On recupere les tableaux des elements de notre GameObject Level.
        //-	Pour chaque tableau, on parcourt les elements
        //-	On recupere l’element, on change son attribut isSpirit.
        //-	On desactive l’element si c’est un element physique et qu’on est en mode esprit, ou si c’est
        //un element spirituel et qu’on est en mode physique. On active l’element sinon.

        if (Input.GetButtonDown("Switch"))
        {
            isSpirit = !isSpirit;
            animator.SetBool("isSpirit", isSpirit);
            int lengthActionneurs = level.actionneurs.Length;
            int lengthEnnemis     = level.ennemis.Length;
            int lengthCadavres    = level.cadavres.Length;
            int lengthPlateformes = level.plateformes.Length;
            int lengthMurs        = level.murs.Length;
            int lengthBackground  = level.backgrounds.Length;

            for (int i = 0; i < lengthActionneurs; i++)
            {
                Actionneur actionneur = (Actionneur)level.actionneurs[i];
                actionneur.isSpirit = isSpirit;
                actionneur.gameObject.SetActive(actionneur.statut == 0 || isSpirit && actionneur.statut == 2 || !isSpirit && actionneur.statut == 1);
            }
            for (int i = 0; i < lengthEnnemis; i++)
            {
                Ennemi ennemi = (Ennemi)level.ennemis[i];
                ennemi.isSpirit = isSpirit;
                ennemi.gameObject.SetActive(ennemi.statut == 0 || isSpirit && ennemi.statut == 2 || !isSpirit && ennemi.statut == 1);
            }
            for (int i = 0; i < lengthCadavres; i++)
            {
                Cadavre cadavre = (Cadavre)level.cadavres[i];
                cadavre.isSpirit = isSpirit;
            }

            for (int i = 0; i < lengthPlateformes; i++)
            {
                Plateforme plateforme = (Plateforme)level.plateformes[i];
                plateforme.isSpirit = isSpirit;
                if (!(plateforme.statut == 0 || isSpirit && plateforme.statut == 2 || !isSpirit && plateforme.statut == 1))
                {
                    for (int j = 0; j < plateforme.transform.childCount; j++)
                    {
                        Transform objet = plateforme.transform.GetChild(j);
                        if (objet.name == "Player")
                        {
                            groundChecker.getTriggers().Clear();
                            objet.transform.parent = null;
                        }
                    }
                }

                plateforme.gameObject.SetActive(plateforme.statut == 0 || isSpirit && plateforme.statut == 2 || !isSpirit && plateforme.statut == 1);
            }
            for (int i = 0; i < lengthMurs; i++)
            {
                Mur mur = (Mur)level.murs[i];
                mur.isSpirit = isSpirit;
                mur.gameObject.SetActive(mur.statut == 0 || isSpirit && mur.statut == 2 || !isSpirit && mur.statut == 1);
            }
            for (int i = 0; i < lengthBackground; i++)
            {
                backgroundAdapter back = (backgroundAdapter)level.backgrounds[i];
                back.changeUnivers(isSpirit);
            }
        }
    }
Example #12
0
    // Update is called once per frame
    void FixedUpdate()
    {
        // etape 1 : aller vers le cadavre
        if (etat == 0)
        {
            Vector2 velocity = rb.velocity;
            velocity.x = moveSpeed;
            animator.SetFloat("hSpeed", Mathf.Abs(rb.velocity.x));
            rb.velocity = velocity;
        }
        // etape 4 : si l'ame est liberee, lancer la suite du scenario
        if (!level.cadavres[0].isActiveAndEnabled && ame.transform.position == init)
        {
            ame.gameObject.SetActive(true);
            ame.envoleToi();
        }
        // etape 3 : liberer l'ame
        if (etat == 2)
        {
            etat = 3;
            level.cadavres[0].activate();
        }
        // etape 2 : stopper le Switcher et passer en mode esprit
        if (etat == 1)
        {
            // on stoppe le Switcher
            Vector3 theScale = transform.localScale;
            theScale.x          *= -1;
            transform.localScale = theScale;
            animator.SetFloat("hSpeed", 0);
            etat = 2;
            // on passe en mode esprit en passant tous les elements de la scene en mode esprit
            isSpirit = !isSpirit;
            animator.SetBool("isSpirit", isSpirit);
            int lengthCadavres    = level.cadavres.Length;
            int lengthPlateformes = level.plateformes.Length;
            int lengthBackground  = level.backgrounds.Length;

            for (int i = 0; i < lengthCadavres; i++)
            {
                Cadavre cadavre = (Cadavre)level.cadavres[i];
                cadavre.isSpirit = isSpirit;
            }

            for (int i = 0; i < lengthPlateformes; i++)
            {
                Plateforme plateforme = (Plateforme)level.plateformes[i];
                plateforme.isSpirit = isSpirit;
                if (!(plateforme.statut == 0 || isSpirit && plateforme.statut == 2 || !isSpirit && plateforme.statut == 1))
                {
                    for (int j = 0; j < plateforme.transform.childCount; j++)
                    {
                        Transform objet = plateforme.transform.GetChild(j);
                        if (objet.name == "Player")
                        {
                            groundChecker.getTriggers().Clear();
                            objet.transform.parent = null;
                        }
                    }
                }

                plateforme.gameObject.SetActive(plateforme.statut == 0 || isSpirit && plateforme.statut == 2 || !isSpirit && plateforme.statut == 1);
            }
            for (int i = 0; i < lengthBackground; i++)
            {
                backgroundAdapter back = (backgroundAdapter)level.backgrounds[i];
                back.changeUnivers(isSpirit);
            }
        }
    }