Ejemplo n.º 1
0
 private Controller.Action NextAction()
 {
     Controller.Action consumedAction = Controller.Action.None;
     if (controller.inputBuffer.Count > 0 && controller.inputBuffer[0] != null)
     {
         consumedAction = controller.inputBuffer[0].Index;
         controller.ConsumeAction(consumedAction);
     }
     return(consumedAction);
 }
Ejemplo n.º 2
0
        void XmlToActions(XmlDocument d, string nodeName, ref Weapon weapon)
        {
            foreach (XmlNode a in d.DocumentElement.SelectNodes("//" + nodeName))
            {
                Controller.Action _a = new Controller.Action();

                XmlNode actionInput = a.SelectSingleNode("ActionInput");
                _a.input = (ActionInput)Enum.Parse(typeof(ActionInput), actionInput.InnerText);

                XmlNode actionType = a.SelectSingleNode("ActionType");
                _a.type = (ActionType)Enum.Parse(typeof(ActionType), actionType.InnerText);

                XmlNode targetAnim = a.SelectSingleNode("targetAnim");
                _a.targetAnim = targetAnim.InnerText;

                XmlNode mirror = a.SelectSingleNode("mirror");
                bool.TryParse(mirror.InnerText, out _a.mirror);
                XmlNode canBeParried = a.SelectSingleNode("canBeParried");
                bool.TryParse(canBeParried.InnerText, out _a.canBeParried);
                XmlNode changeSpeed = a.SelectSingleNode("changeSpeed");
                bool.TryParse(changeSpeed.InnerText, out _a.changeSpeed);

                XmlNode animSpeed = a.SelectSingleNode("animSpeed");
                float.TryParse(animSpeed.InnerText, out _a.animSpeed);

                XmlNode canParry = a.SelectSingleNode("canParry");
                bool.TryParse(canParry.InnerText, out _a.canParry);
                XmlNode canBackstab = a.SelectSingleNode("canBackstab");
                bool.TryParse(canBackstab.InnerText, out _a.canBackstab);
                XmlNode overrideDamangeAnim = a.SelectSingleNode("overrideDamageAnim");
                bool.TryParse(overrideDamangeAnim.InnerText, out _a.overrideDamageAnim);

                XmlNode damageAnim = a.SelectSingleNode("damageAnim");
                _a.damageAnim = damageAnim.InnerText;

                _a.weaponStats = new WeaponStats();

                XmlNode physical = a.SelectSingleNode("physical");
                int.TryParse(physical.InnerText, out _a.weaponStats.physical);
                XmlNode strike = a.SelectSingleNode("strike");
                int.TryParse(strike.InnerText, out _a.weaponStats.strike);
                XmlNode slash = a.SelectSingleNode("slash");
                int.TryParse(slash.InnerText, out _a.weaponStats.slash);
                XmlNode thrust = a.SelectSingleNode("thrust");
                int.TryParse(thrust.InnerText, out _a.weaponStats.thrust);
                XmlNode magic = a.SelectSingleNode("magic");
                int.TryParse(magic.InnerText, out _a.weaponStats.magic);
                XmlNode fire = a.SelectSingleNode("fire");
                int.TryParse(fire.InnerText, out _a.weaponStats.fire);
                XmlNode lighting = a.SelectSingleNode("lighting");
                int.TryParse(lighting.InnerText, out _a.weaponStats.lighting);
                XmlNode dark = a.SelectSingleNode("dark");
                int.TryParse(dark.InnerText, out _a.weaponStats.dark);

                if (nodeName.Equals("actions"))
                {
                    weapon.actions.Add(_a);
                }
                else
                {
                    weapon.two_handedActions.Add(_a);
                }
            }
        }
Ejemplo n.º 3
0
        public void PerformAction(GameTime gt, Controller.Action action)
        {
            if (mouse_move_is_selecting)
            {
                return;
            }
            int amount = 16;

            switch (action)
            {
            case Controller.Action.BOTTOM:
                Position += new Point(0, amount);
                break;

            case Controller.Action.TOP:
                Position += new Point(0, -amount);
                break;

            case Controller.Action.RIGHT:
                Position += new Point(amount, 0);
                break;

            case Controller.Action.LEFT:
                Position += new Point(-amount, 0);
                break;

            case Controller.Action.ZOOM_IN:
                if (TileSize < 32)
                {
                    TileSize++;
                }
                break;

            case Controller.Action.ZOOM_OUT:
                if (TileSize > 3)
                {
                    TileSize--;
                }
                break;

            case Controller.Action.BRUSH_PLUS:
                ShowBrush(gt);
                if (brush_size < 0x20)
                {
                    BrushSize++;
                }
                break;

            case Controller.Action.BRUSH_MINUS:
                ShowBrush(gt);
                if (brush_size > 1)
                {
                    BrushSize--;
                }
                break;

            case Controller.Action.FLIP_VERTICAL:
            case Controller.Action.FLIP_HORIZONTAL:
                ShowBrush(gt);
                bool vertical = action == Controller.Action.FLIP_VERTICAL;
                if (selectionGrid != null)
                {
                    for (int i = 0; i < selectionGrid.GetLength(0); i++)
                    {
                        for (int j = 0; j < selectionGrid.GetLength(1); j++)
                        {
                            if (vertical)
                            {
                                selectionGrid[i, j] = FlipVertically(selectionGrid[i, j]);
                            }
                            else
                            {
                                selectionGrid[i, j] = FlipHorizontally(selectionGrid[i, j]);
                            }
                        }
                    }
                    if (vertical)
                    {
                        selectionGrid = Utils.FlipVertically(selectionGrid);
                    }
                    else
                    {
                        selectionGrid = Utils.FlipHorizontally(selectionGrid);
                    }
                }
                break;

            case Controller.Action.TOGGLE_INVENTORY:
                if (type != Levels.MapType.Minimap)
                {
                    inventoryMode = inventoryMode == InventoryMode.Base ? InventoryMode.No : InventoryMode.Base;
                }
                break;

            case Controller.Action.TOGGLE_CUSTOM_INVENTORY:
                inventoryMode = inventoryMode == InventoryMode.Custom ? InventoryMode.No : InventoryMode.Custom;
                break;

            case Controller.Action.UNDO:
                if (inventoryMode != InventoryMode.Base)
                {
                    CurrentEditableGrid.Undo();
                }
                break;

            case Controller.Action.REDO:
                if (inventoryMode != InventoryMode.Base)
                {
                    CurrentEditableGrid.Redo();
                }
                break;

            case Controller.Action.FORCE_PALETTE:
                if (selectionGrid != null)
                {
                    for (int i = 0; i < selectionGrid.GetLength(0); i++)
                    {
                        for (int j = 0; j < selectionGrid.GetLength(1); j++)
                        {
                            selectionGrid[i, j] = ChangePalette(selectionGrid[i, j], sprites.SelectedSet);
                        }
                    }
                }
                break;
            }
        }