Ejemplo n.º 1
0
        public override void Draw(GameTime gametime, SpriteBatch g)
        {
            switch (GameState)
            {
            case StateofGame.ExplicationLiberation: g.GraphicsDevice.Clear(Color.LightBlue);
                g.DrawString(GameResources.Texte, "\nNiveau Liberation - \nAgent Loxi vous devrez sauver la victime \nen sautant de plateforme en platforme \navant la fin du temps imparti \n" +
                             "sinon le prisonnier sera tué bonne chance !!! \n\nrappel des commande \nWASD=direction\nshift=courir \nEspace=Sauter \nC=Attaque                           Appuyer sur Espace", new Vector2(20, 0), Color.Black);

                break;

            case StateofGame.Game:
                g.End();
                g.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
                        null, null, null, null, Camera.Transform);
                g.GraphicsDevice.Clear(Color.DimGray);
                g.Draw(GameResources.BackgroundEtoile, new Rectangle(-1000, 0, 3000, 1500), null, Color.White, 0, new Vector2(), SpriteEffects.FlipHorizontally, 0);
                g.Draw(GameResources.BackgroundEtoile, new Rectangle(-1000, 1500, 3000, 1500), null, Color.White, 0, new Vector2(), SpriteEffects.None, 0);
                g.Draw(GameResources.BackgroundEtoile, new Rectangle(2000, 0, 3000, 1500), null, Color.White, 0, new Vector2(), SpriteEffects.FlipVertically, 0);
                g.Draw(GameResources.BackgroundEtoile, new Rectangle(2000, 1500, 3000, 1500), null, Color.White, 0, new Vector2(), SpriteEffects.FlipVertically, 0);
                foreach (ObjCollisionable platform in Platforms)
                {
                    platform.Draw(g);
                }
                if (Joueur != null && AnimationPlayer.m_Animation != null)
                {
                    if (Reussi)
                    {
                        g.DrawString(GameResources.Texte, "Win                                                      thankyou!!!", new Vector2(Camera.X - 350, Camera.Y - 220), Color.Red);
                    }
                    else
                    {
                        g.DrawString(GameResources.Texte, TempsJeu.ToString(), new Vector2(Camera.X - 350, Camera.Y - 220), Color.Red);
                        Joueur.Draw(gametime, g);
                    }


                    AnimationPlayer.Draw(gametime, g, PositionDaffi, SpriteEffects.FlipHorizontally);
                }
                break;
            }
        }
        public override void Draw(GameTime gametime, SpriteBatch g)
        {
            Joueur.Draw(gametime, g);

            foreach (ObjCollisionable muret in Mur)
            {
                muret.Draw(g);
            }

            foreach (EnemyPatrol Ennemie in EnnemiesPatrols)
            {
                Ennemie.Draw(gametime, g);
            }

            switch (CurrentEmplacement)
            {
                #region outBase
            case Emplacement.outbase:
                switch (SideofOutBase)
                {
                case EmplacementoutBase.frontside:
                    g.Draw(GameResources.BunkerUpperView, new Rectangle(0, 0, 800, 500), Color.White);
                    g.Draw(GameResources.Donald, new Vector2(450, 200), Color.White);
                    Animationplayer.Draw(gametime, g, new Vector2(350, 250), SpriteEffects.None);
                    Animationplayer.Draw(gametime, g, new Vector2(450, 250), SpriteEffects.FlipHorizontally);
                    Animationplayer.Draw(gametime, g, new Vector2(30, 150), SpriteEffects.None);
                    Animationplayer.Draw(gametime, g, new Vector2(600, 200), SpriteEffects.None);
                    Animationplayer.Draw(gametime, g, new Vector2(600, 100), SpriteEffects.FlipHorizontally);
                    g.Draw(GameResources.BulleParole, new Vector2(200, 350), Color.White);
                    g.DrawString(GameResources.Texte2, Parole, new Vector2(220, 380), Color.Blue);
                    if (RetourAFront == 2)
                    {
                        g.Draw(GameResources.Cercle, new Rectangle(135, 245, 80, 80), Color.White);
                        g.DrawString(GameResources.Texte, "APPUYER SUR ESPACE", new Vector2(220, 280), Color.Red);
                    }
                    else
                    {
                        g.Draw(GameResources.Test, rFlecheDroite, Color.White);
                        g.Draw(GameResources.Test, rFlecheGauche, Color.White);
                        g.Draw(GameResources.Fleche, rFlecheDroite, Color.Blue);
                        g.Draw(GameResources.Fleche, rFlecheGauche, null, Color.Red, 0f, new Vector2(), SpriteEffects.FlipHorizontally, 0f);
                    }
                    break;

                case EmplacementoutBase.leftside:
                    g.Draw(GameResources.BunkerLeftSide, new Rectangle(0, 0, 800, 500), Color.White);
                    g.Draw(GameResources.Test, rFlecheDroite, Color.White);
                    g.Draw(GameResources.Fleche, rFlecheDroite, Color.Blue);
                    EnnemiPatrouille1.Draw(gametime, g);
                    break;

                case EmplacementoutBase.rightside:
                    g.Draw(GameResources.BunkerRightSide, new Rectangle(0, 0, 800, 500), Color.White);
                    g.Draw(GameResources.Test, rFlecheGauche, Color.White);
                    g.Draw(GameResources.Fleche, rFlecheGauche, null, Color.Red, 0f, new Vector2(), SpriteEffects.FlipHorizontally, 0f);
                    EnnemiPatrouille2.Draw(gametime, g);
                    break;
                }

                g.DrawString(GameResources.Texte, "A Pour Aller à gauche et D pour aller à droite", new Vector2(50, 10), Color.White);
                break;

                #endregion
                #region InBase
            case Emplacement.inBase:
                Joueur.Draw(gametime, g);
                g.DrawString(GameResources.Texte2, "JAUGE DE\nDÉTECTION", new Vector2(10, 10), Color.Blue);
                foreach (ObjCollisionable muret in Mur)
                {
                    muret.Draw(g);
                }
                switch (PartofInBase)
                {
                case EmplacementInBase.A:
                    g.GraphicsDevice.Clear(Color.DarkOrange);
                    g.Draw(GameResources.Test, rDestinationb, Color.White);
                    g.DrawString(GameResources.Texte, "PARTIE \n     A", new Vector2(100, 150), Color.Blue);
                    g.DrawString(GameResources.Texte2, "Partie \n Suivante", new Vector2(rDestinationb.X + 40, rDestinationb.Y + 40), Color.Blue);
                    break;

                case EmplacementInBase.B:
                    g.GraphicsDevice.Clear(Color.IndianRed);
                    g.Draw(GameResources.Test, rDestinationc, Color.White);
                    g.DrawString(GameResources.Texte, "PARTIE \n     B", new Vector2(200, 220), Color.Blue);
                    g.DrawString(GameResources.Texte2, "Partie \n Suivante", new Vector2(rDestinationc.X + 40, rDestinationc.Y + 40), Color.Blue);
                    break;

                case EmplacementInBase.C:
                    g.GraphicsDevice.Clear(Color.DarkGray);
                    g.Draw(GameResources.Test, rDestinationd, Color.White);
                    g.DrawString(GameResources.Texte, "PARTIE \n     C", new Vector2(600, 220), Color.Blue);
                    g.DrawString(GameResources.Texte2, "Partie     Suivante", new Vector2(rDestinationd.X + 10, rDestinationd.Y + 10), Color.Blue);
                    break;
                }
                break;

                #endregion
                #region ExplicationNiv1
            case Emplacement.ExplicationNiv1:
                g.GraphicsDevice.Clear(Color.Black);
                g.DrawString(GameResources.Texte, Parole, new Vector2(), Color.Red);
                break;
                #endregion
            }

            if (BarreDeDetection != null)
            {
                BarreDeDetection.Draw(g);
            }
        }
        public override void Draw(GameTime gametime, SpriteBatch g)
        {
            switch (StateOfGame)
            {
                #region beforeFight
            case GameState.BeforeFight:
                g.Draw(GameResources.grotte, new Vector2(), Color.SlateGray);
                g.Draw(GameResources.Perchoir, new Rectangle(300, 100, 140, 140), Color.SlateGray);
                if (Timer >= 2)
                {
                    g.Draw(GameResources.SplinterSingle, new Rectangle(300, 100, GameResources.SplinterSingle.Width * 2, GameResources.SplinterSingle.Height * 2), Color.White);

                    if (Timer >= 3)
                    {
                        g.Draw(GameResources.BulleParole, BullePosition, null, Color.White, RotationBulle, new Vector2(), SpriteEffects.None, 0);
                        g.DrawString(GameResources.Texte2, Parole, ParolePosition, CouleurParole);
                    }

                    if (Timer >= 16)
                    {
                        AnimationPlayer.Draw(gametime, g, new Vector2(600, 300), SpriteEffects.None);
                    }

                    if (Timer >= 20)
                    {
                        g.DrawString(GameResources.Texte2, "Direction = A,D\n Sauter = Espace\n Tirer = C \n Courir=Shift+Direction", new Vector2(10, 10), Color.White);
                    }
                }
                break;

                #endregion
                #region Fight
            case GameState.Raphael:
                if (Presentationfinie)
                {
                    g.Draw(GameResources.grotte2, new Vector2(), Color.OrangeRed);
                }
                break;

            case GameState.Michelangelo:
                if (Presentationfinie)
                {
                    g.Draw(GameResources.grotte3, new Vector2(), Color.Orange);
                }
                break;

            case GameState.Donatello:
                if (Presentationfinie)
                {
                    g.Draw(GameResources.grotte4, new Vector2(), Color.Purple);
                }
                break;

            case GameState.Leonardo:
            {
                if (Presentationfinie)
                {
                    g.Draw(GameResources.grotte5, new Vector2(), Color.Blue);
                }
            }
            break;

                #endregion
                #region afterFight
            case GameState.AfterFight:
                g.Draw(GameResources.grotte5, new Vector2(), Color.Gray);

                if (Timer <= 7 || Timer >= 14)
                {
                    g.Draw(GameResources.SplinterSingle, new Rectangle(190, 200, GameResources.SplinterSingle.Width * 2, GameResources.SplinterSingle.Height * 2), Color.White);
                }
                else
                {
                    AnimationPlayer.Draw(gametime, g, new Vector2(270, 350), SpriteEffects.None);
                }

                if (Timer >= 1)
                {
                    g.Draw(GameResources.BulleParole, BullePosition, null, Color.White, RotationBulle, new Vector2(), SpriteEffects.None, 0);
                    g.DrawString(GameResources.Texte2, Parole, ParolePosition, CouleurParole);
                }

                AP2.Draw(gametime, g, new Vector2(400, 500), SpriteEffects.FlipHorizontally);
                AP3.Draw(gametime, g, new Vector2(490, 500), SpriteEffects.FlipHorizontally);
                AP4.Draw(gametime, g, new Vector2(580, 500), SpriteEffects.FlipHorizontally);
                AP5.Draw(gametime, g, new Vector2(670, 500), SpriteEffects.FlipHorizontally);
                break;
                #endregion
            }

            #region Affichage lors des présentation
            if (StateOfGame != GameState.BeforeFight && StateOfGame != GameState.AfterFight && !Presentationfinie)
            {
                g.GraphicsDevice.Clear(Color.Black);
                AnimationPlayer.Draw(gametime, g, new Vector2(g.GraphicsDevice.Viewport.Width / 2, g.GraphicsDevice.Viewport.Height), SpriteEffects.None);
                if (AnimationPlayer.m_FrameIndex == 3)
                {
                    g.DrawString(GameResources.Texte, OpponentName, new Vector2(550, 100), OpponentColor);
                    g.DrawString(GameResources.Texte2, "Direction = A,D\n Sauter = Espace\n Tirer = C \n Courir=Shift+Direction", new Vector2(10, 10), OpponentColor);
                }
            }
            #endregion
            //Sinon
            #region Affiche Bonhomme et Ennemi
            else
            {
                Joueur.Draw(gametime, g);
                if (Vie != null && MechantVie != null && Ennemi != null && !ColorBackToNormal)
                {
                    Vie.Draw(g);
                    MechantVie.Draw(g);
                    Ennemi.Draw(g, gametime);
                }
            }
            #endregion
        }