Esempio n. 1
0
        public EngineStateDialogue(int character, CharacterController _npc, CharacterController player, bool is_companion)
            : base(EngineManager.Engine)
        {
            m_baseImage = new GameTexture(@"Sprites/RPG/PopupScreen");

            if (GameplayManager.ActiveArea.GlobalLocation != Area.PARTY)
            {
                m_dialog = DialogManager.get(character);
            }
            else
            {
                // TODO put social game results here!
                m_dialog = new Dialog(character+" played a social game, or passed or whatever...", false, Color.WhiteSmoke);
            }
            m_button4_released = false;

            drawOnCompanionSide = is_companion;

            //brewMode = false;
            bouncerMode = false;
            bouncerPass = false;
            bouncerDist = 0;
            bouncerI = 0;
            npc = _npc;

            if (npc != null && npc.getCollider().m_type == ColliderType.NPC && player != null && player.brew != null)
            {
                if (npc.bouncer != null)
                {
                    m_dialog = null;
                    bouncerMode = true;
                    bouncerPass = npc.bouncer.canPass(player.brew, (int)npc.getCollider().Bounds.Center().X, (int)npc.getCollider().Bounds.Center().Y, (int)npc.getCollider().Bounds.Width, (int)npc.getCollider().Bounds.Height, (int)player.getCollider().Bounds.Center().X, (int)player.getCollider().Bounds.Center().Y, (int)player.getCollider().Bounds.Width, (int)player.getCollider().Bounds.Height);

                    //if what was passed in is the player, then add what task he's currently doing to the plan.
                    if (bouncerPass && !is_companion)
                    {
                        player.addTaskToPlan(npc.bouncer);
                    }
                }
                else if (npc.brew != null)
                {
                    //if what was passed in is the player, then add what task he's currently doing to the plan.

                    //brewMode = true;
                    if (player.brew.mix(npc.brew))
                    {
                        m_dialog = null;
                        if (!is_companion)
                        {
                            player.addTaskToPlan(npc.brew);
                        }
                    }
                    else
                    {
                        m_dialog = new Dialog("I don't have the right brew for this mixture");
                    }
                }
            }
        }
Esempio n. 2
0
 public override void update(GameTime gameTime)
 {
     if (bouncerMode)
     {
         if (!bouncerPass)
         {
             m_dialog = new Dialog("Bouncer: Only cool people allowed past here!", false, Color.PapayaWhip);
             bouncerMode = false;
         }
         else
         {
             // do_path
             if (bouncerI < npc.bouncer.getPathSize())
             {
                 int dir = npc.bouncer.getPath(bouncerI);
                 int distance = npc.m_speed;
                 string animName = npc.angleTo4WayAnimation((float)Math.PI / 2);
                 if (dir == Bouncer.PATH_UP || dir == Bouncer.PATH_DOWN)
                 {
                     if (dir == Bouncer.PATH_DOWN)
                     {
                         animName = npc.angleTo4WayAnimation(3 * (float)Math.PI / 2);
                     }
                     if (bouncerDist + distance > Area.TILE_HEIGHT)
                     {
                         distance = Area.TILE_HEIGHT - bouncerDist;
                         bouncerI++;
                         bouncerDist = 0;
                     }
                     else
                     {
                         bouncerDist += distance;
                     }
                     npc.getCollider().handleMovement(new Vector2(0, dir > 0 ? distance : -distance));
                 }
                 else
                 {
                     if (dir == Bouncer.PATH_LEFT)
                     {
                         animName = npc.angleTo4WayAnimation((float)Math.PI);
                     }
                     else
                     {
                         animName = npc.angleTo4WayAnimation(0);
                     }
                     if (bouncerDist + distance > Area.TILE_WIDTH)
                     {
                         distance = Area.TILE_WIDTH - bouncerDist;
                         bouncerI++;
                         bouncerDist = 0;
                     }
                     else
                     {
                         bouncerDist += distance;
                     }
                     npc.getCollider().handleMovement(new Vector2(dir > 0 ? distance : -distance, 0));
                 }
                 npc.AnimationController.requestAnimation(animName, AnimationController.AnimationCommand.Play);
                 npc.AnimationController.update();
             }
             else
             {
                 bouncerMode = false;
                 npc.bouncer.switchDirection();
             }
         }
     }
     else if (!Quest.gameOver && (InputSet.getInstance().getButton(InputsEnum.BUTTON_1) ||
         InputSet.getInstance().getButton(InputsEnum.BUTTON_2) ||
         InputSet.getInstance().getButton(InputsEnum.CONFIRM_BUTTON) ||
         InputSet.getInstance().getButton(InputsEnum.CANCEL_BUTTON) ||
         (m_button4_released && InputSet.getInstance().getButton(InputsEnum.BUTTON_4)) ||
         m_dialog == null))
     {
         EngineManager.popState();
         InputSet.getInstance().setAllToggles();
         return;
     }
     if (!InputSet.getInstance().getButton(InputsEnum.BUTTON_4))
     {
         m_button4_released = true;
     }
 }