Example #1
0
 public ClientHead(Client c)
     : base("tetes", Vector2.Zero, new Rectangle(c.IsWoman ? 256 : 0, 0, 128, 128), Vector2.One)
 {
     client = c;
     updateLocation();
 }
Example #2
0
 public ClientBody(Client c)
     : base("corps", Vector2.Zero, new Rectangle(c.IsWoman ? 128 : 0, 0, 128, c.IsWoman ? 256 : 220), Vector2.One)
 {
     client = c;
     updateLocation();
 }
Example #3
0
        protected override void InternalLoad()
        {
            m_hp = 100;
            m_currentClient = null;
            m_currentProduct = null;
            m_rankActive = false;
            m_shaker = false;
            m_scanning = false;
            m_manualMode = false;
            m_magasinCA = 0;
            m_youCA = 0;
            m_price = 0;
            m_cashier = new Cashier();
            m_hand = new Hand();
            m_basket = new ClientBasket();
            m_time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 0, 0);
            Matrix world, view, projection;
            world = Matrix.Identity;
            view = Matrix.CreateLookAt(new Vector3(0, 0, 5), Vector3.Zero, Vector3.Up);
            projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Application.Graphics.GraphicsDevice.Viewport.AspectRatio, 1, 10);
            m_render = new Model3DRenderer(Application.Graphics.GraphicsDevice, Application.SpriteBatch, projection, view, world);
            m_ending = false;
            m_pauseMidi = false;
            m_pauseMidiAnimation = false;
            m_bossZone = new Rectangle(Application.Graphics.GraphicsDevice.Viewport.Width - 80, 30, 80, 120);
            SceneCamera.FadeOut(40, null, Color.Chocolate);
            m_barCodeQte = new BarCodeQTE();
            m_rank = new Rectangle(0, 0, 300, 150);

            MusicPlayer.PlayGameMusic();

            Timer.Create(1f, true, (t =>
            {
                m_magasinCA += Application.Random.GetRandomFloat(10, 50);

            }));
        }
Example #4
0
        private void handleInput()
        {
            // Appui sur espace : ACTION
            var key = Application.InputManager.GetDevice<KeyboardDevice>(SuperCaissiere.Engine.Input.LogicalPlayerIndex.One);

            if (m_scanning && !m_barCodeQte.isActive() && (key.GetState(SuperCaissiere.Engine.Input.MappingButtons.B).IsPressed || key.GetState(SuperCaissiere.Engine.Input.MappingButtons.X).IsPressed))
            {
                m_manualMode = true;
                m_barCodeQte.start();
            }

            if (m_currentClient.Items.Count == 0) //okay on a passé tous les articles
            {
                if (m_textbox == null)
                {
                    if (key.GetState(SuperCaissiere.Engine.Input.MappingButtons.A).IsPressed)
                    {
                        switch (m_diagFSM)
                        {
                            case 0: m_textbox = new TextBox("Sa fera " + m_price + "Euro s'il vous plé", true);
                                Timer.Create(0.02f, true, (t =>
                                {
                                    m_currentClient.Location -= new Vector2(5, 0);
                                    if (m_currentClient.Location.X < 100) t.Stop();
                                }));
                                break;
                            case 1:
                                Application.MagicContentManager.GetSound("fidelite1", "fidelite2", "fidelite3").Play();
                                m_textbox = new TextBox("Vous avez la carte du magazin?", true);
                                break;
                            case 2:
                                Application.MagicContentManager.GetSound("bonne-journee", "aurevoir1", "aurevoir2", "aurevoir3").Play();
                                m_textbox = new TextBox("Ayez une bonne journée", true);
                                break;
                            case 3:
                                m_textbox = new TextBox("Au revoir et a bientot", true);
                                break;
                        }
                        m_diagFSM++;
                    }
                    if (m_diagFSM == 4)
                    {
                        m_diagFSM++;
                        Timer.Create(0.02f, true, (t =>
                        {
                            if (m_currentClient == null) t.Stop();
                            m_currentClient.Location -= new Vector2(5, 0);
                            if (m_currentClient.Location.X < -100)
                            {
                                t.Stop();
                                m_currentClient = null;
                            }
                        }));
                    }
                }

            }
            if (m_scanning)
            {
                //ici on fait tourner les serviettes :3
                m_render.resetRotate();
                if (key.ThumbStickLeft.Y < 0) m_render.rotateX(-0.05f); //up
                if (key.ThumbStickLeft.Y > 0) m_render.rotateX(0.05f); //down
                if (key.ThumbStickLeft.X < 0) m_render.rotateY(-0.05f); //left
                if (key.ThumbStickLeft.X > 0) m_render.rotateY(0.05f);  //right
            }

            if (m_textbox == null && m_scanning) //Malus
                if (key.GetState(SuperCaissiere.Engine.Input.MappingButtons.A).IsPressed)
                {
                    m_hp -= 5;

                    shakeShakeShake();
                }

            // Possible uniquement si on ne fait rien d'autre
            if (key.GetState(SuperCaissiere.Engine.Input.MappingButtons.A).IsDown)
            {
                if (m_currentProduct == null)
                {

                    if (m_currentClient != null)
                    {
                        foreach (Product p in m_currentClient.Items)
                        {
                            p.Location += new Vector2(-2, 0);
                            if (p.Location.X < 450)
                            {
                                m_currentProduct = p;
                                Timer.Create(0.02F, true, (t =>
                                {
                                    m_currentProduct.Location += new Vector2(-5, 0);
                                    if (m_currentProduct.Location.X < 300)
                                    {
                                        t.Stop();
                                        m_render.setModel(m_currentProduct.getModel(), m_currentProduct.getCollider());
                                        m_render.isActive = true;
                                        m_manualMode = false;
                                        m_scanTime = 0;
                                        m_scanning = true;
                                        m_timerScan = 0;
                                    }
                                }));

                            }
                        }
                    }
                }

            }
            //brulage de retine des clients
            if (m_textbox == null && m_currentClient != null)
            {
                var mouse = Application.InputManager.GetDevice<MouseDevice>(SuperCaissiere.Engine.Input.LogicalPlayerIndex.One);
                if (mouse.GetState(SuperCaissiere.Engine.Input.MappingButtons.A).IsPressed)
                {

                    if (m_currentClient.whereIsMyMind().Intersects(new Rectangle((int)mouse.MouseLocation.X, (int)mouse.MouseLocation.Y, 1, 1)))
                    {
                        blinkScan();
                        m_textbox = new TextBox("ARGH ! MES ZYEU ! ! !\n ME MANIFIK ZIEUX ! ! !", false);
                        shakeShakeShake();
                        m_hp -= 5;
                    }
                }

            }
            // Clic sur la souris = SCAN
            if (m_scanning)
            {
                var mouse = Application.InputManager.GetDevice<MouseDevice>(SuperCaissiere.Engine.Input.LogicalPlayerIndex.One);
                bool validate = false;
                if (mouse.GetState(SuperCaissiere.Engine.Input.MappingButtons.A).IsPressed)
                {
                    //blinkScan();
                    if (m_render.isClicked((int)mouse.MouseLocation.X, (int)mouse.MouseLocation.Y))
                    {
                        m_scanTime++;
                        if (m_scanTime > 10)
                        {
                            m_textbox = new TextBox("Caisse centrale dit:\n Ce code bare semble être corrompu, presser \n'Ctrl' pour commuté au mode manuel", true);
                        }
                        if (!m_currentProduct.IsCorrupted) validate = true;
                    }
                }
                else if (m_manualMode && m_barCodeQte.isValidated)
                {
                    validate = true;
                }

                if (validate)
                {
                    Application.MagicContentManager.GetSound("bip1", "bip2").Play();

                    m_scanning = false;
                    displayRank(m_timerScan);
                    m_price += m_currentProduct.Price;
                    Timer.Create(0.02F, true, (t =>
                    {
                        // Déplacement du produit dans le panier final
                        m_currentProduct.Location += new Vector2(-5, 0);
                        if (m_currentProduct.Location.X < -100)
                        {
                            t.Stop();
                            m_basket.AddItem(m_currentProduct);
                            m_currentClient.Items.Dequeue();
                            m_currentProduct = null;
                            m_scanTime = 0;
                        }
                    }));
                    m_render.isActive = false;
                }
            }
        }
Example #5
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            if (m_textbox == null || !m_textbox.IsModal)
            {
                if (m_textbox != null)
                {
                    m_textbox.Update(gameTime);
                    if (m_textbox.isDone())
                    {
                        m_textbox = null;
                    }
                }
                // Mise à jour du temps
                float delta = 3;
                delta = 1; // DEBUG

                if (m_pauseMidi)
                {
                    delta = 5;
                }
                m_time = m_time.AddMinutes(gameTime.ElapsedGameTime.TotalSeconds * delta);

                if (m_scanning) m_timerScan += gameTime.ElapsedGameTime.Milliseconds;

                m_render.Update(gameTime);
                if (m_pauseMidi == false)
                {
                    // Mise à jour des entités
                    m_cashier.Update(gameTime);
                    m_hand.Update(gameTime);
                    m_basket.Update(gameTime);

                    if (m_currentProduct != null)
                    {
                        if (!m_manualMode)
                            m_render.Update(gameTime);
                        else
                            m_barCodeQte.Update(gameTime);
                    }
                    // Ajouter un client s'il n'y en a plus
                    if (m_currentClient == null)
                    {
                        m_currentClient = new Client(new Vector2(Application.Graphics.GraphicsDevice.Viewport.Width + 10, 50), new Vector2(Application.Graphics.GraphicsDevice.Viewport.Width - 10, 450));
                        Timer.Create(0.02f, true, (t =>
                            {
                                m_currentClient.Location -= new Vector2(5, 0);
                                m_youCA += m_price;
                                m_price = 0;
                                m_diagFSM = 0;
                                if (m_currentClient.Location.X <= 500)
                                {
                                    t.Stop();
                                    m_textbox = new TextBox(m_currentClient.getSentence(), false);

                                    Application.MagicContentManager.GetSound("bonjour1", "bonjour2", "bonjour3").Play();
                                }

                            }));
                    }

                    m_currentClient.Update(gameTime);
                    foreach (Product produits in m_currentClient.Items.ToList())
                    {
                        produits.Update(gameTime);
                    }

                    manageEnd();

                    // Gestion entrées joueur
                    handleInput();
                }
                // Pause du midi
                else
                {
                    if (m_time.Hour > 13)
                    {
                        if (m_pauseMidiAnimation)
                        {
                            m_pauseMidiAnimation = false;

                            SceneCamera.FadeIn(30, () =>
                            {
                                m_pauseMidi = false;
                                SceneCamera.FadeOut(30, null, Color.White);
                            }, Color.HotPink);
                        }
                    }
                }

            }
            else
            {
                m_textbox.Update(gameTime);
                var key = Application.InputManager.GetDevice<KeyboardDevice>(SuperCaissiere.Engine.Input.LogicalPlayerIndex.One);
                if (key.GetState(SuperCaissiere.Engine.Input.MappingButtons.A).IsPressed)
                    m_textbox = null;

            }
            base.Update(gameTime);
        }