コード例 #1
0
        private void ShowCharacterActionMenu(Character character)
        {
            character.DestroyMovableAndAttackableAndAssistableTransforms();
            Path.Hide();

            GameManager.CharacterActionMenu.Clear();

            // Attack
            HashSet <Vector2> attackablePositions = character.CalculateAttackablePositions();

            AttackableSpacesWithCharacters.Clear();
            if (attackablePositions.Count > 0)
            {
                GameManager.CharacterActionMenu.AddMenuItem(null, GameManager.AttackTextPrefab, CharacterActionMenuAttack);
            }

            // Assist
            HashSet <Vector2> assistablePositions = character.CalculateAssistablePositions();

            if (assistablePositions.Count > 0)
            {
                GameManager.CharacterActionMenu.AddMenuItem(null, GameManager.AssistTextPrefab, CharacterActionMenuAssist);
            }

            // Trade
            HashSet <Vector2> tradablePositionsWithCharacters = character.CalculateTradablePositionsWithCharacters();

            if (tradablePositionsWithCharacters.Count > 0)
            {
                GameManager.CharacterActionMenu.AddMenuItem(null, GameManager.TradeTextPrefab, CharacterActionMenuTrade);
            }

            // Items
            if (character.Items.Count > 0)
            {
                GameManager.CharacterActionMenu.AddMenuItem(null, GameManager.ItemsTextPrefab, CharacterActionMenuItems);
            }

            // Wait
            GameManager.CharacterActionMenu.AddMenuItem(null, GameManager.WaitTextPrefab, CharacterActionMenuWait);

            GameManager.CharacterActionMenu.Focus();
            GameManager.CharacterActionMenu.transform.position = new Vector2(character.transform.position.x - 1, character.transform.position.y);
            GameManager.CharacterActionMenu.Show(CharacterActionMenuOnCancel);
        }
コード例 #2
0
        private void ItemSelectionMenuOnSelectAttackItem(Object[] objects)
        {
            Item item = GameManager.ItemSelectionMenu.MenuItems[GameManager.ItemSelectionMenu.CurrentMenuItemIndex].ItemObject;

            Debug.LogFormat("Selected a weapon: {0}", item.Text.text);
            SelectedCharacter.Equip(item);

            AttackableSpacesWithCharacters.Clear();
            HashSet <Vector2> attackablePositions = SelectedCharacter.CalculateAttackablePositions(transform.position.x, transform.position.y, ((Attackable)item).Ranges);

            AttackableSpacesWithCharacters
            .AddRange(SelectedCharacter
                      .CreateAttackableTransforms(SelectedCharacter
                                                  .ExtractAttackablePositionsWithCharacters(attackablePositions)));

            CurrentState = State.ChoosingAttackTarget;
            GameManager.ItemSelectionMenu.Hide();
            SetAttackableSpaceWithCharacter();
            Focus();
        }