コード例 #1
0
ファイル: Jeu.cs プロジェクト: SkaM-DEV/WildlyneDungeon
        //méthode -------------------------------------------

        public Jeu(Canvas canvas1, TextBlock tbInventaire, Inventaire inventaire)
        {
            //sauvegarde du canvas / inventaire

            _canvas       = canvas1;
            _tbInventaire = tbInventaire;
            _inventaire   = inventaire;

            //Création Salle
            _salle = new Salle(40, 40, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +     // X = mur
                               "XXXXXXXXXXXXXXXXXXXXXXXF.........FXXXXXX" +             // . = sol
                               "XXXXX.C..OXXXXXXXXXXXXX...........XXXXXX" +             // O = coffre ouvert
                               "XXXXX...S................TTTTTT...XXXXXX" +             // F = coffre fermé
                               "XXXXXXXXXXXXXXXXXXXXXXX..TTTTTT...XXXXXX" +             // S = flaque de sang
                               "XXXXXXXXXXXXXXXXXXXXXXX...........XXXXXX" +             // T = table basse
                               "XXXXXXXXXXXXXXXXXXXXXXX..........fXXXXXX" +             // C = crâne
                               "XXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXT.C.XXXXXXXXXXXX.XXXXXXXXXXXXXXXX" +             //
                               "XXXXXXX....XXXXXXXXXXXX.XXXXXXXXXXXXXXXX" +             //
                               "XXXXXXX.................XXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXX.S....XXXXXXXXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXX......XXXXXXXXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXX.F.S.............XXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXX..S........XXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXX.........S.XXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXX.S...T.....XXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXX...........XXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXX" +             //
                               "XXXXXXF.....C.............XXXXXXXXXXXXXX" +             //
                               "XXXXXXF....XXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXF...TXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXX" +             //
                               "XXXXXXXXXXXXXXXXXXXXXSXXXXXXXXXXXXXXXXXXX");


            // on ajoute la salle dans le canvas
            _salle.setX((Convert.ToInt32(canvas1.ActualWidth) - _salle.getL() * Tuile.LARGEUR) / 2);
            _salle.setY((Convert.ToInt32(canvas1.ActualHeight) - _salle.getH() * Tuile.HAUTEUR) / 2);

            _salle.ajouteAuCanvas(canvas1);
            _salle.miseAJourPosition();


            //Création personnage
            _heros = new Personnage("héros.png", 32, 32, 10, 10, _salle);

            //set/mise à jour position dans le canvas
            _heros.mettreAJourPositionGraphique();
            _heros.ajouteAuCanvas(canvas1);
        }