Example #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");
                    }
                }
            }
        }
        /// <summary>
        /// Factory method to create CharacterControllers
        /// </summary>
        /// <param name="ci">Information about character apperance and stats</param>
        /// <param name="startpos">Where in the Area the character should be placed</param>
        /// <param name="playerControlled">True if the character should be a PC, false if NPC</param>
        /// <returns>Constructed CharacterController</returns>
        public static CharacterController construct(CharacterInfo ci, Vector2 startpos, bool playerControlled, int npcID)
        {
            CharacterController cc;
            ColliderType type;
            if (playerControlled)
            {
                cc = new PlayerController();
                type = ColliderType.PC;
            }
            else
            {
                cc = new CharacterController();
                type = ColliderType.NPC;
            }

            cc.m_npc_id = npcID;
            cc.m_position = startpos;

            cc.AnimationController = new AnimationController(ci.animationDataPath, ci.animationTexturePath);
            cc.AnimationController.ActionTriggered += new ActionTriggeredEventHandler(cc.handleAction);
            cc.AnimationController.Scale = ci.scale;

            Rectangle bounds = ci.collisionBox;
            bounds.Offset((int)cc.m_position.X, (int)cc.m_position.Y);
            cc.m_collider = new Collider(cc, bounds, type, cc.m_npc_id);

            cc.m_speed = ci.speed;

            cc.m_previousAngle = (float)Math.PI / 2;

            return cc;
        }
Example #3
0
 /**
  * Interact with the object
  *@param pc
  *@param obj
  */
 public void interact(CharacterController pc, int obj)
 {
     for (int j = 0; j < GameObjects.Count; j++)
     {
         if (((ICollidable)GameObjects[j]).getCollider().m_type == ColliderType.NPC)
         {
             CharacterController npc = (CharacterController)GameObjects[j];
             if ((npc.bouncer != null && obj == npc.bouncer.id) || (npc.brew != null && obj == npc.brew.id))
             {
                 EngineManager.pushState(new EngineStateDialogue(npc.getDoodadIndex(), npc, pc, true));
             }
         }
     }
 }
Example #4
0
        /// <summary>
        /// Factory method to create CharacterControllers
        /// </summary>
        /// <param name="ci">Information about character apperance and stats</param>
        /// <param name="startpos">Where in the Area the character should be placed</param>
        /// <param name="playerControlled">True if the character should be a PC, false if NPC</param>
        /// <returns>Constructed CharacterController</returns>
        public static CharacterController construct(CharacterInfo ci, Vector2 startpos, Constants.CharType typeOfChar, PlayerController p)
        {
            CharacterController cc;
            cc = new CharacterController();
            cc.m_doodadIndex = 0;
            ColliderType type;
            if (typeOfChar == Constants.CharType.PLAYERCHAR)
            {
                cc = new PlayerController();
                type = ColliderType.PC;

                cc.m_doodadIndex = Constants.PLAYER;
                cc.bouncer = null;
                cc.brew = new Brew(0, 0);

                currPlan = null;// new ActionNode(ActionNode.EMPTY);
            }
            else if (typeOfChar == Constants.CharType.NPCHAR)
            {
                type = ColliderType.NPC;

                cc.bouncer = null;

                cc.brew = null;
            }
            else
            {
                cc = new CompanionController(p);
                type = ColliderType.PC;
                cc.m_doodadIndex = Constants.COMPANION;

                cc.bouncer = null;
                cc.brew = new Brew(0, 0);
            }

            cc.m_position = startpos;

            cc.AnimationController = new AnimationController(ci.animationDataPath, ci.animationTexturePath);
            cc.AnimationController.ActionTriggered += new ActionTriggeredEventHandler(cc.handleAction);
            cc.AnimationController.Scale = ci.scale;

            Rectangle bounds = ci.collisionBox;
            bounds.Offset((int)cc.m_position.X, (int)cc.m_position.Y);
            cc.m_collider = new Collider(cc, bounds, type);

            cc.m_speed =  ci.speed;

            //if(PCControllerInput.

            cc.m_previousAngle = (float)Math.PI / 2;

            cc.victim = -1;
            cc.social_game = null;

            cc.walking = false;
            cc.walk_target = -1;
            cc.walk_dir = -1;
            cc.distance = 0;

            return cc;
        }