예제 #1
0
 protected override void OnCommandSelected(BattlePlayer player)
 {
     BattleUIManager.Instance.StartTargetSelection(new List <BattleEntity>()
     {
         player
     }, false);
 }
예제 #2
0
        protected override void OnCommandSelected(BattlePlayer player)
        {
            BattleMenu itemMenu = new BattleMenu(new Vector2f(40f, GameCore.GameWindow.Size.Y - 150), new Vector2f(100, 38),
                                                 BattleMenu.GridTypes.Vertical);

            itemMenu.OnOpen = () => PopulateItemList(player);
            BattleUIManager.Instance.PushInputMenu(itemMenu);
        }
예제 #3
0
        private void SelectItem(BattlePlayer player, Item item)
        {
            ItemUsed = item;

            BattleEntity.EntityTypes entityType = item.GetEntityTypeBasedOnAlignment(player.EntityType);
            bool multiTarget = item.MultiTarget;

            BattleManager.EntityFilterStates filterState = item.FilterState;

            BattleUIManager.Instance.StartTargetSelection(BattleManager.Instance.GetEntityGroup(entityType, filterState), multiTarget);
        }
        private void SelectSpell(BattlePlayer player, Spell spell)
        {
            if (player.CurMP < spell.MPCost)
            {
                Debug.Log($"{player.Name} has {player.CurMP}MP but requires {spell.MPCost}MP to cast {spell.Name}!");
                return;
            }

            SpellCast     = spell;
            TurnsRequired = SpellCast.CastTurns;

            BattleEntity.EntityTypes entityType = spell.GetEntityTypeBasedOnAlignment(player.EntityType);
            bool multiTarget = spell.MultiTarget;

            BattleManager.EntityFilterStates filterState = spell.FilterState;

            BattleUIManager.Instance.StartTargetSelection(BattleManager.Instance.GetEntityGroup(entityType, filterState), multiTarget);
        }
예제 #5
0
        private void PopulateItemList(BattlePlayer player)
        {
            Dictionary <Item, int>       items   = BattleManager.Instance.PartyInventory.GetInventory();
            List <BattleMenu.MenuOption> options = new List <BattleMenu.MenuOption>();

            if (items.Count == 0)
            {
                options.Add(new BattleMenu.MenuOption("Empty Inventory - Exit", BattleUIManager.Instance.PopInputMenu));
            }
            else
            {
                foreach (KeyValuePair <Item, int> pair in items)
                {
                    options.Add(new BattleMenu.MenuOption($"{pair.Key.Name} x{pair.Value}", () => SelectItem(player, pair.Key)));
                }
            }

            BattleUIManager.Instance.GetInputMenu().SetElements(options);
        }
        private void PopulateSpellList(BattlePlayer player)
        {
            List <BattleMenu.MenuOption> options = new List <BattleMenu.MenuOption>();

            Dictionary <string, Spell> entityspells = player.GetAllSpells();

            if (entityspells.Count == 0)
            {
                options.Add(new BattleMenu.MenuOption("No spells - Exit", BattleUIManager.Instance.PopInputMenu));
            }
            else
            {
                foreach (KeyValuePair <string, Spell> spell in entityspells)
                {
                    options.Add(new BattleMenu.MenuOption($"{spell.Value.Name}", () => SelectSpell(player, spell.Value)));
                }
            }

            BattleUIManager.Instance.GetInputMenu().SetElements(options);
        }
예제 #7
0
        public void Start(params BattleEntity[] entities)
        {
            //Unsubscribe first then subscribe, in case the battle was started again before being disposed
            BattleEntity.EntityDeathEvent -= OnEntityDeath;
            BattleEntity.EntityDeathEvent += OnEntityDeath;

            BattleState = BattleStates.Init;

            AddEntities(entities);

            TurnOrder = new List <BattleEntity>(Entities);
            TurnOrder.Sort(SortBySpeed);

            BattleState = BattleStates.TurnDone;

            BattleUIManager.Instance.Start();

            //Initialize static battle components
            BattlePlayer.BattleStart();
        }
 /// <summary>
 /// What occurs when the command is selected in the menu
 /// </summary>
 /// <param name="player">The BattlePlayer that selected the command</param>
 protected abstract void OnCommandSelected(BattlePlayer player);
 /// <summary>
 /// Selects the command in the menu
 /// </summary>
 /// <param name="player">The BattleEntity that selected the command</param>
 public void OnSelect(BattlePlayer player)
 {
     player.SetCommand(this);
     OnCommandSelected(player);
 }
 protected override void OnCommandSelected(BattlePlayer player)
 {
     BattleUIManager.Instance.StartTargetSelection(BattleManager.Instance.GetEntityGroup(BattleEntity.EntityTypes.Enemy, BattleManager.EntityFilterStates.Alive), false);
 }